Skip to content
/ flag Public

A Bash script for parsing command-line flags with support for long and short flags, including values enclosed in double quotes.

License

Notifications You must be signed in to change notification settings

AmosNimos/flag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Flag - A Bash script for parsing command line flags

🏴‍☠️ Description

Flag is a Bash script that simplifies the process of parsing command-line flags in your Bash scripts. It parse flags and convert them to easy-to-use variables in your script.

🏴‍☠️ What does it stand for?

Flag stands for "Friendly Linux Argument Gatherer" or, if you like recursion, "Flag: Linux Argument Gatherer."

🏴‍☠️ Usage

To use flag in your Bash scripts, simply source the script and pass the arguments directly to it, like this:

source /path/to/flag.sh "$@"

The script parses both short flags (single-letter flags preceded by a single dash, e.g., -a) and long flags (multi-character flags preceded by two dashes, e.g., --test). Flags without a value are set to 1 (true as boolean). The variables set will be flag_[flag], for example, flag_a for flag -a and flag_test for --test.

🏴‍☠️ License

Flag is licensed under GNU GPL. See the LICENSE file for details.

🏴‍☠️ Author

Flag was created by Amosnimos.

GitHub

About

A Bash script for parsing command-line flags with support for long and short flags, including values enclosed in double quotes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published