Skip to content

Commit d404e2c

Browse files
authored
Merge pull request #560 from DannyBen/fix/conflicts-fixed-flags
Fix `conflicts` in fixed flags
2 parents c93532e + 152069a commit d404e2c

File tree

10 files changed

+53
-5
lines changed

10 files changed

+53
-5
lines changed

examples/render-mandoc/docs/download.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" Automatically generated by Pandoc 3.2
22
.\"
3-
.TH "download" "1" "September 2024" "Version 0.1.0" "Sample application"
3+
.TH "download" "1" "October 2024" "Version 0.1.0" "Sample application"
44
.SH NAME
55
\f[B]download\f[R] \- Sample application
66
.SH SYNOPSIS

examples/render-mandoc/docs/download.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% download(1) Version 0.1.0 | Sample application
22
% Lana Lang
3-
% September 2024
3+
% October 2024
44

55
NAME
66
==================================================

lib/bashly/views/command/fixed_flags_filter.gtx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
= view_marker
22

33
> while [[ $# -gt 0 ]]; do
4-
> case "${1:-}" in
4+
> key="$1"
5+
> case "$key" in
56

67
if root_command?
78
= (short_flag_exist?("-v") ? "--version)" : "--version | -v)").indent(4)

spec/approvals/examples/dependencies-alt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ args: none
1414
deps:
1515
- ${deps[git]} = /usr/bin/git
1616
- ${deps[http_client]} = /usr/bin/curl
17-
- ${deps[ruby]} = /home/vagrant/.rbenv/versions/3.3.0/bin/ruby
17+
- ${deps[ruby]} = /home/vagrant/.rbenv/versions/3.3.5/bin/ruby

spec/approvals/examples/render-mandoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ ISSUE TRACKER
4444
AUTHORS
4545
Lana Lang.
4646

47-
Version 0.1.0 September 2024 download(1)
47+
Version 0.1.0 October 2024 download(1)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
+ bundle exec bashly generate
2+
creating user files in src
3+
created src/test_command.sh
4+
created ./cli
5+
run ./cli --help to test your bash script
6+
+ ./cli
7+
cli
8+
9+
Usage:
10+
cli [OPTIONS] COMMAND
11+
cli [COMMAND] --help | -h
12+
cli --version | -v
13+
14+
Commands:
15+
test
16+
17+
+ ./cli --fast --slow
18+
conflicting options: --slow cannot be used with --fast
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cli
2+
src/*.sh
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This fixture tests that flags with `conflicts` work properly when defined
2+
in a "fixed flags" context (i.e., when both flags and commands are defined).
3+
Reference issue: https://github.com/DannyBen/bashly/issues/559
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: cli
2+
version: 0.1.0
3+
4+
flags:
5+
- long: --fast
6+
short: -f
7+
conflicts: [--slow]
8+
- long: --slow
9+
short: -s
10+
conflicts: [--fast]
11+
12+
commands:
13+
- name: test
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
rm -f ./cli
4+
rm -f ./src/*.sh
5+
6+
set -x
7+
8+
bundle exec bashly generate
9+
10+
./cli
11+
./cli --fast --slow

0 commit comments

Comments
 (0)