Create and modify Argcfiles using the special syntax required. Use this when editing Argcfile.sh, @argc, or any shell script that contains `argc --argc-eval`.
Argc is a Bash command line framework that utilizes a special comment-driven syntax to provide a command runner and argument parser.
Here is a simple Argcfile.sh:
# @describe Example Argcfile
# Arguments, options, and flags listed here apply to the main command and all
# subcommands.
#
# For more information about argc, see https://github.com/sigoden/argc
# @option --name Name to greet
# @flag -F --foo Flag param
# @option --bar Option param
# @option --baz* Option param (multi-occurs)
# @arg val* Positional param
main() {
echo foo: $argc_foo
echo bar: $argc_bar
echo baz: ${argc_baz[@]}
echo val: ${argc_val[@]}
}
if ! command -v argc >/dev/null; then
echo "This command requires argc. Install from https://github.com/sigoden/argc" >&2
exit 100
fi
eval "$(argc --argc-eval "$0" "$@")"
Run the script with some sample arguments:
./example.sh -F --bar=xyz --baz a --baz b v1 v2
Argc parses these arguments and creates variables prefixed with argc_: