rkotze / git-mob

Co-author commits tool. A cross-platform command-line tool for social coding. Includes co-authors in commits when pair/mob programming.
https://www.npmjs.com/package/git-mob
MIT License
183 stars 21 forks source link

Make it easier to select co-author to pair with #91

Open rkotze opened 2 years ago

rkotze commented 2 years ago

Summary

It can be tricky to remember all your co-authors and it could be a better experience if you can have an interactive cli selector.

Motivation

This will reduce the cognitive load to remember your co-author list and reduce the number of commands to run to append co-author data.

Describe alternatives you've considered

Currently, you can run git mob -l and then you can run the mob command.

Ideas

Maybe Inquirer library can be used to create an interactive select cli command

jonsmithers commented 1 year ago

This can be DIY'd with fzf

# in ~/.zshrc or ~/.bashrc
function gmob() {
  git mob $(git mob -l | fzf --multi | awk '{print $1;}' | tr '\n' ' ')
}

You can also get really fancy with it:

# in ~/.zshrc or ~/.bashrc
function gmob_fancy() {
  git mob $(cat ~/.git-coauthors | jq -r '.coauthors | to_entries[] | .key+" "+.value.name' | fzf --multi --height=10% --preview='git log --author={2..} --color=always' | awk '{print $1;}' | tr '\n' ' ')
}

update Aug 2023:

# in ~/.zshrc or ~/.bashrc
function gmob() {
  local selected=$(git mob -l \
    | fzf --multi \
      --layout=reverse \
      --height=11 \
      --border=rounded \
      --prompt='🦜 Pair with ' \
    | awk '{print $1;}' \
    | tr '\n' ' ' \
    | sed 's/,//g' )
  [[ -n "$selected" ]] && git mob $(echo $selected)
}
rkotze commented 1 year ago

These are great suggestions.

But I'm thinking this would be helpful for people not familiar with making custom bash functions.

I'm not 100% if this is a valuable feature