Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conflicts in fixed flags #560

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading