diff --git a/examples/render-mandoc/docs/download.1 b/examples/render-mandoc/docs/download.1 index adb73be8..9f75126e 100644 --- a/examples/render-mandoc/docs/download.1 +++ b/examples/render-mandoc/docs/download.1 @@ -1,6 +1,6 @@ .\" Automatically generated by Pandoc 3.2 .\" -.TH "download" "1" "September 2024" "Version 0.1.0" "Sample application" +.TH "download" "1" "October 2024" "Version 0.1.0" "Sample application" .SH NAME \f[B]download\f[R] \- Sample application .SH SYNOPSIS diff --git a/examples/render-mandoc/docs/download.md b/examples/render-mandoc/docs/download.md index cbd1b20e..bec7a9c5 100644 --- a/examples/render-mandoc/docs/download.md +++ b/examples/render-mandoc/docs/download.md @@ -1,6 +1,6 @@ % download(1) Version 0.1.0 | Sample application % Lana Lang -% September 2024 +% October 2024 NAME ================================================== diff --git a/lib/bashly/views/command/fixed_flags_filter.gtx b/lib/bashly/views/command/fixed_flags_filter.gtx index 1eae8b2d..a51b80e0 100644 --- a/lib/bashly/views/command/fixed_flags_filter.gtx +++ b/lib/bashly/views/command/fixed_flags_filter.gtx @@ -1,7 +1,8 @@ = view_marker > while [[ $# -gt 0 ]]; do -> case "${1:-}" in +> key="$1" +> case "$key" in if root_command? = (short_flag_exist?("-v") ? "--version)" : "--version | -v)").indent(4) diff --git a/spec/approvals/examples/dependencies-alt b/spec/approvals/examples/dependencies-alt index 338578e9..563a4752 100644 --- a/spec/approvals/examples/dependencies-alt +++ b/spec/approvals/examples/dependencies-alt @@ -14,4 +14,4 @@ args: none deps: - ${deps[git]} = /usr/bin/git - ${deps[http_client]} = /usr/bin/curl -- ${deps[ruby]} = /home/vagrant/.rbenv/versions/3.3.0/bin/ruby +- ${deps[ruby]} = /home/vagrant/.rbenv/versions/3.3.5/bin/ruby diff --git a/spec/approvals/examples/render-mandoc b/spec/approvals/examples/render-mandoc index 95029b27..ca383f90 100644 --- a/spec/approvals/examples/render-mandoc +++ b/spec/approvals/examples/render-mandoc @@ -44,4 +44,4 @@ ISSUE TRACKER AUTHORS Lana Lang. -Version 0.1.0 September 2024 download(1) +Version 0.1.0 October 2024 download(1) diff --git a/spec/approvals/fixtures/conflicts-fixed-flags b/spec/approvals/fixtures/conflicts-fixed-flags new file mode 100644 index 00000000..a69e2581 --- /dev/null +++ b/spec/approvals/fixtures/conflicts-fixed-flags @@ -0,0 +1,18 @@ ++ bundle exec bashly generate +creating user files in src +created src/test_command.sh +created ./cli +run ./cli --help to test your bash script ++ ./cli +cli + +Usage: + cli [OPTIONS] COMMAND + cli [COMMAND] --help | -h + cli --version | -v + +Commands: + test + ++ ./cli --fast --slow +conflicting options: --slow cannot be used with --fast diff --git a/spec/fixtures/workspaces/conflicts-fixed-flags/.gitignore b/spec/fixtures/workspaces/conflicts-fixed-flags/.gitignore new file mode 100644 index 00000000..235a70c8 --- /dev/null +++ b/spec/fixtures/workspaces/conflicts-fixed-flags/.gitignore @@ -0,0 +1,2 @@ +cli +src/*.sh diff --git a/spec/fixtures/workspaces/conflicts-fixed-flags/README.md b/spec/fixtures/workspaces/conflicts-fixed-flags/README.md new file mode 100644 index 00000000..fce40a1e --- /dev/null +++ b/spec/fixtures/workspaces/conflicts-fixed-flags/README.md @@ -0,0 +1,3 @@ +This fixture tests that flags with `conflicts` work properly when defined +in a "fixed flags" context (i.e., when both flags and commands are defined). +Reference issue: https://github.com/DannyBen/bashly/issues/559 diff --git a/spec/fixtures/workspaces/conflicts-fixed-flags/src/bashly.yml b/spec/fixtures/workspaces/conflicts-fixed-flags/src/bashly.yml new file mode 100644 index 00000000..e577bb31 --- /dev/null +++ b/spec/fixtures/workspaces/conflicts-fixed-flags/src/bashly.yml @@ -0,0 +1,13 @@ +name: cli +version: 0.1.0 + +flags: +- long: --fast + short: -f + conflicts: [--slow] +- long: --slow + short: -s + conflicts: [--fast] + +commands: +- name: test diff --git a/spec/fixtures/workspaces/conflicts-fixed-flags/test.sh b/spec/fixtures/workspaces/conflicts-fixed-flags/test.sh new file mode 100644 index 00000000..cb9daf64 --- /dev/null +++ b/spec/fixtures/workspaces/conflicts-fixed-flags/test.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +rm -f ./cli +rm -f ./src/*.sh + +set -x + +bundle exec bashly generate + +./cli +./cli --fast --slow