using-argc-argcfilelisted
Install: claude install-skill aiskillstore/marketplace
# Argc
[Argc](https://github.com/sigoden/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:
```bash
# @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:
```bash
./example.sh -F --bar=xyz --baz a --baz b v1 v2
```
Argc parses these arguments and creates variables prefixed with argc_:
```
foo: 1
bar: xyz
baz: a b
val: v1 v2
```
You can also run ./example.sh --help to see the automatically generated help information for your CLI.
## Bash idioms
Prefer using Bash idioms when working with argc. For example, shellcheck isn't aware of the argc_foo variables, so prefer using `${argc_foo:?}` for required values and values where argc is known to provide the default. For others, use `${argc_foo:-default}`, as appropriate