Skip to content

Commit

Permalink
Merge pull request #75 from DannyBen/update/git-branch-command
Browse files Browse the repository at this point in the history
Update instructions and template for obtaining list of git branches
  • Loading branch information
DannyBen authored Nov 25, 2024
2 parents c413d31 + 8cdfabd commit 9230b1a
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ mygit status:
- --help
- --verbose
- --branch
- $(git branch 2>/dev/null)
- $(git branch --format='%(refname:short)' 2>/dev/null)

mygit init:
- --bare
Expand Down Expand Up @@ -169,7 +169,7 @@ branches to your suggestions, use the following:

```yaml
mygit:
- $(git branch 2>/dev/null)
- $(git branch --format='%(refname:short)' 2>/dev/null)
```

The `2> /dev/null` is used so that if the command is executed in a directory
Expand All @@ -186,10 +186,10 @@ mygit checkout:
- -b
mygit checkout*--branch:
- $(git branch 2>/dev/null)
- $(git branch --format='%(refname:short)' 2>/dev/null)
mygit checkout*-b:
- $(git branch 2>/dev/null)
- $(git branch --format='%(refname:short)' 2>/dev/null)
```

The above will suggest git branches for commands that end with `-b` or `--branch`.
Expand All @@ -202,7 +202,7 @@ mygit checkout:
- -b
mygit checkout*--branch: &branches
- $(git branch 2>/dev/null)
- $(git branch --format='%(refname:short)' 2>/dev/null)
mygit checkout*-b: *branches
```
Expand Down
2 changes: 1 addition & 1 deletion lib/completely/templates/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mygit status:
- --help
- --verbose
- --branch
- $(git branch 2>/dev/null)
- $(git branch --format='%(refname:short)' 2>/dev/null)

mygit init:
- --bare
Expand Down
2 changes: 1 addition & 1 deletion spec/approvals/cli/generated-script
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ _mygit_completions() {

case "$compline" in
'status'*)
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2>/dev/null)")" -- "$cur")
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur")
;;

'commit'*)
Expand Down
2 changes: 1 addition & 1 deletion spec/approvals/cli/generated-script-alt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ _mycomps() {

case "$compline" in
'status'*)
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mycomps_filter "--help --verbose --branch $(git branch 2>/dev/null)")" -- "$cur")
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mycomps_filter "--help --verbose --branch $(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur")
;;

'commit'*)
Expand Down
2 changes: 1 addition & 1 deletion spec/approvals/cli/generated-wrapped-script
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ give_comps() {
echo $''
echo $' case "$compline" in'
echo $' \'status\'*)'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2>/dev/null)")" -- "$cur")'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch --format=\'%(refname:short)\' 2>/dev/null)")" -- "$cur")'
echo $' ;;'
echo $''
echo $' \'commit\'*)'
Expand Down
2 changes: 1 addition & 1 deletion spec/approvals/cli/test/completely-tester-1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ _mygit_completions() {

case "$compline" in
'status'*)
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2>/dev/null)")" -- "$cur")
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur")
;;

'commit'*)
Expand Down
2 changes: 1 addition & 1 deletion spec/approvals/cli/test/completely-tester-2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ _mygit_completions() {

case "$compline" in
'status'*)
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2>/dev/null)")" -- "$cur")
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur")
;;

'commit'*)
Expand Down
2 changes: 1 addition & 1 deletion spec/approvals/cli/test/completely-tester.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ _mygit_completions() {

case "$compline" in
'status'*)
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2>/dev/null)")" -- "$cur")
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur")
;;

'commit'*)
Expand Down

0 comments on commit 9230b1a

Please sign in to comment.