Replies: 2 comments 1 reply
-
There is more than one way to achieve what you want. If this is intended for developer-side debugging, I would avoid adding it as a user flag, and instead add something like this: # src/initialize.sh
[[ $DEBUG ]] && set -x (See Function Hooks) then you can set the If you wish to still have a globally available flag, you can simply add it on the parent command (see note on this page). For example: # src/bashly.yml
name: cli
help: Sample application
version: 0.1.0
flags:
- long: --verbose
short: -v
repeatable: true
help: Set verbose output
commands:
- name: download
alias: d
help: Download a file
flags:
- long: --force
short: -f
help: Overwrite existing files
- name: upload
alias: u
help: Upload a file $ ./cli -vvv download -f
# this file is located in 'src/download_command.sh'
# code for 'cli download' goes here
# you can edit it freely and regenerate (it will not be overwritten)
args:
- ${args[--force]} = 1
- ${args[--verbose]} = 3 Does this help? |
Beta Was this translation helpful? Give feedback.
0 replies
-
That's beautiful ! thank you so much ! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I often find myself needing to set
set -x
in generated script to troubleshoot issues.I was thinking to add a generic flag like
-vvv
that would apply to all my commands.Do you see a way to do that without having to declare the flag in each command ?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions