Skip to content

Flag v3: Enhanced Flag Parsing for Bash Scripts

Latest
Compare
Choose a tag to compare
@AmosNimos AmosNimos released this 22 Apr 21:21
· 7 commits to main since this release

This release of the flag script includes improvements to its functionality and readability. Color variables are now defined locally within the print_help function, ensuring better scoping. Default value handling for flags without specified values has been enhanced, and the script retains its logic for concatenating values for flags with multiple arguments. These updates enhance the overall usability and maintainability of the script.

You can now use the script as follow:
flag -a hello world -b --text "world-hello" --TEXT Some text

this will initialize the following variables:

flag_a="hello world"
flag_b="1"
flag_text="world-hello"
flag_TEXT="Some text"