Skip to content

Commit faf9216

Browse files
authored
Merge pull request #500 from DannyBen/update/hyphen-arg-test
Update flag-args-with-dash test to validate #499
2 parents c7f7e80 + c8b4208 commit faf9216

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

spec/approvals/fixtures/flag-args-with-dash

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,19 @@ args:
1616
args:
1717
- ${args[--force]} = 1
1818
- ${args[--options]} = --verbose --anything
19+
+ BASHLY_COMPACT_SHORT_FLAGS=no
20+
+ bundle exec bashly generate
21+
creating user files in src
22+
skipped src/root_command.sh (exists)
23+
created ./argflag
24+
run ./argflag --help to test your bash script
25+
+ ./argflag -o -force
26+
# this file is located in 'src/root_command.sh'
27+
# you can edit it freely and regenerate (it will not be overwritten)
28+
args:
29+
- ${args[--options]} = -force
30+
+ ./argflag -o '-f -o'
31+
# this file is located in 'src/root_command.sh'
32+
# you can edit it freely and regenerate (it will not be overwritten)
33+
args:
34+
- ${args[--options]} = -f -o

spec/fixtures/workspaces/flag-args-with-dash/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,14 @@ starts with a dash - for example:
55
--options '--verbose -v'
66
```
77

8-
Reference issue: https://github.com/DannyBen/bashly/issues/58
8+
Note that when it is expected that flag arguments will be in a form that
9+
resembles a collection of short flags (i.e. single hyphen followed by
10+
alphanumeric characters), for example `--options -abc`, then the compact flags
11+
feature should be disabled with `compact_short_flags: false` in the settings.
12+
13+
See https://bashly.dannyb.co/usage/settings/#compact_short_flags
14+
15+
Reference issues:
16+
17+
- https://github.com/DannyBen/bashly/issues/58
18+
- https://github.com/DannyBen/bashly/issues/499
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#!/usr/bin/env bash
22

3-
# This fixture tests that alias command codes work properly
4-
# It is executed as part of the Runfile examples test
5-
# Reference issue: https://github.com/DannyBen/bashly/issues/16
6-
73
rm -f ./src/*.sh
84
rm -f ./argflag
95

@@ -14,3 +10,10 @@ bundle exec bashly generate
1410
./argflag -f -o
1511
./argflag -o -f
1612
./argflag -o '--verbose --anything' -f
13+
14+
# if flag args are expected to look like a short flag collection, it is
15+
# necessary to disable `compact_short_flags` either in settings or environment
16+
# variable.
17+
BASHLY_COMPACT_SHORT_FLAGS=no bundle exec bashly generate
18+
./argflag -o -force
19+
./argflag -o '-f -o'

0 commit comments

Comments
 (0)