Skip to content

Commit 8e73959

Browse files
committed
add no-compact-flags test
1 parent 0554c22 commit 8e73959

File tree

7 files changed

+78
-0
lines changed

7 files changed

+78
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
creating user files in src
2+
skipped src/initialize.sh (exists)
3+
skipped src/root_command.sh (exists)
4+
created ./cli
5+
run ./cli --help to test your bash script
6+
+ ./cli -abc --delta
7+
# this file is located in 'src/root_command.sh'
8+
# you can edit it freely and regenerate (it will not be overwritten)
9+
args:
10+
- ${args[--alpha]} = 1
11+
- ${args[--bravo]} = 1
12+
- ${args[--charlie]} = 1
13+
- ${args[--delta]} = 1
14+
+ BASHLY_COMPACT_SHORT_FLAGS=no
15+
+ bundle exec bashly generate
16+
creating user files in src
17+
skipped src/initialize.sh (exists)
18+
skipped src/root_command.sh (exists)
19+
created ./cli
20+
run ./cli --help to test your bash script
21+
+ ./cli -abc --delta
22+
invalid option: -abc
23+
+ ./cli -a -b -c
24+
# this file is located in 'src/root_command.sh'
25+
# you can edit it freely and regenerate (it will not be overwritten)
26+
args:
27+
- ${args[--alpha]} = 1
28+
- ${args[--bravo]} = 1
29+
- ${args[--charlie]} = 1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cli
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This fixture tests that setting `compact_short_flags` to `false` indeed ignores
2+
this `-abc` pattern.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: cli
2+
help: Sample application
3+
version: 0.1.0
4+
5+
flags:
6+
- long: --alpha
7+
short: -a
8+
help: Alpha
9+
- long: --bravo
10+
short: -b
11+
help: Bravo
12+
- long: --charlie
13+
short: -c
14+
help: Charlie
15+
- long: --delta
16+
short: -d
17+
help: Delta
18+
19+
20+
21+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Code here runs inside the initialize() function
2+
## Use it for anything that you need to run before any other function, like
3+
## setting environment variables:
4+
## CONFIG_FILE=settings.ini
5+
##
6+
## Feel free to empty (but not delete) this file.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
echo "# this file is located in 'src/root_command.sh'"
2+
echo "# you can edit it freely and regenerate (it will not be overwritten)"
3+
inspect_args
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
# This fixture tests that setting `compact_short_flags` to `false` indeed ignores
4+
# this `-abc` pattern.
5+
6+
bundle exec bashly generate
7+
8+
set -x
9+
10+
./cli -abc --delta
11+
12+
# Use ad-hoc setting through an environment variable
13+
BASHLY_COMPACT_SHORT_FLAGS="no" bundle exec bashly generate
14+
15+
./cli -abc --delta
16+
./cli -a -b -c

0 commit comments

Comments
 (0)