File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # mygit completion -*- shell-script -*-
2+
3+ # This bash completions script was generated by
4+ # completely (https://github.com/dannyben/completely)
5+ # Modifying it manually is not recommended
6+
7+ _mygit_completions_filter () {
8+ local words=" $1 "
9+ local cur=${COMP_WORDS[COMP_CWORD]}
10+ local result=()
11+
12+ if [[ " ${cur: 0: 1} " == " -" ]]; then
13+ echo " $words "
14+
15+ else
16+ for word in $words ; do
17+ [[ " ${word: 0: 1} " != " -" ]] && result+=(" $word " )
18+ done
19+
20+ echo " ${result[*]} "
21+
22+ fi
23+ }
24+
25+ _mygit_completions () {
26+ local cur=${COMP_WORDS[COMP_CWORD]}
27+ local compwords=(" ${COMP_WORDS[@]: 1: $COMP_CWORD -1} " )
28+ local compline=" ${compwords[*]} "
29+
30+ case " $compline " in
31+ * )
32+ while read -r; do COMPREPLY+=(" $REPLY " ); done < <( compgen -W " $( _mygit_completions_filter " status commit" ) " -- " $cur " )
33+ ;;
34+
35+ esac
36+ } &&
37+ complete -o nosort -F _mygit_completions mygit
38+
39+ # ex: filetype=sh
Original file line number Diff line number Diff line change 4949 . except ( /case.*/m )
5050 end
5151 end
52+
53+ context 'with a configuration file that includes complete_options' do
54+ let ( :file ) { 'complete_options' }
55+
56+ it 'adds the complete_options to the complete_command' do
57+ expect ( subject . script ) . to match_approval 'completions/script-complete-options'
58+ end
59+ end
5260 end
5361
5462 describe '#wrapper_function' do
Original file line number Diff line number Diff line change 99 expect ( subject . flat_config . to_yaml ) . to match_approval ( 'config/flat_config' )
1010 end
1111 end
12+
13+ context 'when complete_options is defined' do
14+ let ( :file ) { 'complete_options' }
15+
16+ describe 'config' do
17+ it 'ignores the completely_config YAML key' do
18+ expect ( subject . config . keys ) . to eq [ "mygit" ]
19+ end
20+ end
21+
22+ describe 'options' do
23+ it 'returns complete_options from the YAML file' do
24+ expect ( subject . options [ :complete_options ] ) . to eq '-o nosort'
25+ end
26+ end
27+ end
1228end
Original file line number Diff line number Diff line change 1+ completely_options :
2+ complete_options : -o nosort
3+
4+ mygit :
5+ - status
6+ - commit
You can’t perform that action at this time.
0 commit comments