Skip to content

Commit 4825a37

Browse files
authored
Merge pull request #69 from DannyBen/add/shfmt-validation
Check output with shfmt
2 parents a0c3a62 + 3f7ae7e commit 4825a37

File tree

15 files changed

+69
-54
lines changed

15 files changed

+69
-54
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ jobs:
1919
- name: Install OS dependencies
2020
run: sudo apt-get -y install libyaml-dev
2121

22+
# Rush needed for easy installation of stuff
23+
- name: Install rush
24+
run: curl -Ls http://get.dannyb.co/rush/setup | bash
25+
26+
- name: Connect rush repo
27+
run: rush clone dannyben --shallow --default
28+
29+
- name: Install shfmt
30+
run: rush get shfmt
31+
2232
- name: Setup Ruby
2333
uses: ruby/setup-ruby@v1
2434
with:

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ mygit status:
7777
- --help
7878
- --verbose
7979
- --branch
80-
- $(git branch 2> /dev/null)
80+
- $(git branch 2>/dev/null)
8181

8282
mygit init:
8383
- --bare
@@ -169,7 +169,7 @@ branches to your suggestions, use the following:
169169

170170
```yaml
171171
mygit:
172-
- $(git branch 2> /dev/null)
172+
- $(git branch 2>/dev/null)
173173
```
174174

175175
The `2> /dev/null` is used so that if the command is executed in a directory
@@ -186,10 +186,10 @@ mygit checkout:
186186
- -b
187187
188188
mygit checkout*--branch:
189-
- $(git branch 2> /dev/null)
189+
- $(git branch 2>/dev/null)
190190
191191
mygit checkout*-b:
192-
- $(git branch 2> /dev/null)
192+
- $(git branch 2>/dev/null)
193193
```
194194

195195
The above will suggest git branches for commands that end with `-b` or `--branch`.
@@ -202,7 +202,7 @@ mygit checkout:
202202
- -b
203203
204204
mygit checkout*--branch: &branches
205-
- $(git branch 2> /dev/null)
205+
- $(git branch 2>/dev/null)
206206
207207
mygit checkout*-b: *branches
208208
```

lib/completely/templates/sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mygit status:
99
- --help
1010
- --verbose
1111
- --branch
12-
- $(git branch 2> /dev/null)
12+
- $(git branch 2>/dev/null)
1313

1414
mygit init:
1515
- --bare

lib/completely/templates/template.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
% patterns.each do |pattern|
4242
% next if pattern.empty?
4343
<%= pattern.case_string %>)
44-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen <%= pattern.compgen %> -- "$cur" )
44+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen <%= pattern.compgen %> -- "$cur")
4545
;;
4646

4747
% end
4848
esac
4949

5050
COMP_WORDBREAKS="$original_comp_wordbreaks"
5151
} &&
52-
complete -F <%= function_name %> <%= command %>
52+
complete -F <%= function_name %> <%= command %>
5353

5454
# ex: filetype=sh

spec/approvals/cli/generated-script

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,25 @@ _mygit_completions() {
3232

3333
case "$compline" in
3434
'status'*)
35-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2> /dev/null)")" -- "$cur" )
35+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2>/dev/null)")" -- "$cur")
3636
;;
3737

3838
'commit'*)
39-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "$(_mygit_completions_filter "--help --message --all -a --quiet -q")" -- "$cur" )
39+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_mygit_completions_filter "--help --message --all -a --quiet -q")" -- "$cur")
4040
;;
4141

4242
'init'*)
43-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur" )
43+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur")
4444
;;
4545

4646
*)
47-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mygit_completions_filter "--help --version status init commit")" -- "$cur" )
47+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --version status init commit")" -- "$cur")
4848
;;
4949

5050
esac
5151

5252
COMP_WORDBREAKS="$original_comp_wordbreaks"
5353
} &&
54-
complete -F _mygit_completions mygit
54+
complete -F _mygit_completions mygit
5555

5656
# ex: filetype=sh

spec/approvals/cli/generated-script-alt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,25 @@ _mycomps() {
3232

3333
case "$compline" in
3434
'status'*)
35-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mycomps_filter "--help --verbose --branch $(git branch 2> /dev/null)")" -- "$cur" )
35+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mycomps_filter "--help --verbose --branch $(git branch 2>/dev/null)")" -- "$cur")
3636
;;
3737

3838
'commit'*)
39-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "$(_mycomps_filter "--help --message --all -a --quiet -q")" -- "$cur" )
39+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_mycomps_filter "--help --message --all -a --quiet -q")" -- "$cur")
4040
;;
4141

4242
'init'*)
43-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -W "$(_mycomps_filter "--bare")" -- "$cur" )
43+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_mycomps_filter "--bare")" -- "$cur")
4444
;;
4545

4646
*)
47-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mycomps_filter "--help --version status init commit")" -- "$cur" )
47+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mycomps_filter "--help --version status init commit")" -- "$cur")
4848
;;
4949

5050
esac
5151

5252
COMP_WORDBREAKS="$original_comp_wordbreaks"
5353
} &&
54-
complete -F _mycomps mygit
54+
complete -F _mycomps mygit
5555

5656
# ex: filetype=sh

spec/approvals/cli/generated-wrapped-script

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,26 @@ give_comps() {
3333
echo $''
3434
echo $' case "$compline" in'
3535
echo $' \'status\'*)'
36-
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2> /dev/null)")" -- "$cur" )'
36+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2>/dev/null)")" -- "$cur")'
3737
echo $' ;;'
3838
echo $''
3939
echo $' \'commit\'*)'
40-
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "$(_mygit_completions_filter "--help --message --all -a --quiet -q")" -- "$cur" )'
40+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_mygit_completions_filter "--help --message --all -a --quiet -q")" -- "$cur")'
4141
echo $' ;;'
4242
echo $''
4343
echo $' \'init\'*)'
44-
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur" )'
44+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur")'
4545
echo $' ;;'
4646
echo $''
4747
echo $' *)'
48-
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mygit_completions_filter "--help --version status init commit")" -- "$cur" )'
48+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --version status init commit")" -- "$cur")'
4949
echo $' ;;'
5050
echo $''
5151
echo $' esac'
5252
echo $''
5353
echo $' COMP_WORDBREAKS="$original_comp_wordbreaks"'
5454
echo $'} &&'
55-
echo $'complete -F _mygit_completions mygit'
55+
echo $' complete -F _mygit_completions mygit'
5656
echo $''
5757
echo $'# ex: filetype=sh'
5858
}

spec/approvals/cli/test/completely-tester-1.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,26 @@ _mygit_completions() {
4040

4141
case "$compline" in
4242
'status'*)
43-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2> /dev/null)")" -- "$cur" )
43+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2>/dev/null)")" -- "$cur")
4444
;;
4545

4646
'commit'*)
47-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "$(_mygit_completions_filter "--help --message --all -a --quiet -q")" -- "$cur" )
47+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_mygit_completions_filter "--help --message --all -a --quiet -q")" -- "$cur")
4848
;;
4949

5050
'init'*)
51-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur" )
51+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur")
5252
;;
5353

5454
*)
55-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mygit_completions_filter "--help --version status init commit")" -- "$cur" )
55+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --version status init commit")" -- "$cur")
5656
;;
5757

5858
esac
5959

6060
COMP_WORDBREAKS="$original_comp_wordbreaks"
6161
} &&
62-
complete -F _mygit_completions mygit
62+
complete -F _mygit_completions mygit
6363

6464
# ex: filetype=sh
6565

spec/approvals/cli/test/completely-tester-2.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,26 @@ _mygit_completions() {
4040

4141
case "$compline" in
4242
'status'*)
43-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2> /dev/null)")" -- "$cur" )
43+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2>/dev/null)")" -- "$cur")
4444
;;
4545

4646
'commit'*)
47-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "$(_mygit_completions_filter "--help --message --all -a --quiet -q")" -- "$cur" )
47+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_mygit_completions_filter "--help --message --all -a --quiet -q")" -- "$cur")
4848
;;
4949

5050
'init'*)
51-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur" )
51+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur")
5252
;;
5353

5454
*)
55-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mygit_completions_filter "--help --version status init commit")" -- "$cur" )
55+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --version status init commit")" -- "$cur")
5656
;;
5757

5858
esac
5959

6060
COMP_WORDBREAKS="$original_comp_wordbreaks"
6161
} &&
62-
complete -F _mygit_completions mygit
62+
complete -F _mygit_completions mygit
6363

6464
# ex: filetype=sh
6565

spec/approvals/cli/test/completely-tester.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,26 @@ _mygit_completions() {
4040

4141
case "$compline" in
4242
'status'*)
43-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2> /dev/null)")" -- "$cur" )
43+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --verbose --branch $(git branch 2>/dev/null)")" -- "$cur")
4444
;;
4545

4646
'commit'*)
47-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "$(_mygit_completions_filter "--help --message --all -a --quiet -q")" -- "$cur" )
47+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_mygit_completions_filter "--help --message --all -a --quiet -q")" -- "$cur")
4848
;;
4949

5050
'init'*)
51-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur" )
51+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur")
5252
;;
5353

5454
*)
55-
while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mygit_completions_filter "--help --version status init commit")" -- "$cur" )
55+
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help --version status init commit")" -- "$cur")
5656
;;
5757

5858
esac
5959

6060
COMP_WORDBREAKS="$original_comp_wordbreaks"
6161
} &&
62-
complete -F _mygit_completions mygit
62+
complete -F _mygit_completions mygit
6363

6464
# ex: filetype=sh
6565

0 commit comments

Comments
 (0)