Skip to content

Commit

Permalink
- Fix conflicts in fixed flags
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyBen committed Oct 16, 2024
1 parent c93532e commit 152069a
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/render-mandoc/docs/download.1
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/render-mandoc/docs/download.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% download(1) Version 0.1.0 | Sample application
% Lana Lang
% September 2024
% October 2024

NAME
==================================================
Expand Down
3 changes: 2 additions & 1 deletion lib/bashly/views/command/fixed_flags_filter.gtx
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spec/approvals/examples/dependencies-alt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion spec/approvals/examples/render-mandoc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
18 changes: 18 additions & 0 deletions spec/approvals/fixtures/conflicts-fixed-flags
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions spec/fixtures/workspaces/conflicts-fixed-flags/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cli
src/*.sh
3 changes: 3 additions & 0 deletions spec/fixtures/workspaces/conflicts-fixed-flags/README.md
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions spec/fixtures/workspaces/conflicts-fixed-flags/src/bashly.yml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions spec/fixtures/workspaces/conflicts-fixed-flags/test.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 152069a

Please sign in to comment.