| name | getopts-parser-generator |
| description | Generate getopts-based argument parsing for shell scripts with short/long options and validation. |
| allowed-tools | Read, Write, Edit, Bash, Glob, Grep |
| graph | {"domains":["domain:software-engineering"],"specializations":["specialization:cli-mcp-development"],"skillAreas":["skill-area:cli-design","skill-area:mcp-server-implementation","skill-area:parsing-data-formats"],"roles":["role:backend-engineer","role:platform-engineer"],"workflows":["workflow:feature-development"],"topics":["topic:developer-experience"]} |
Getopts Parser Generator
Generate getopts-based argument parsing for shell scripts.
Capabilities
- Generate getopts parsing code
- Support short and long options
- Implement option validation
- Create help text generation
- Handle required arguments
- Generate usage documentation
Usage
Invoke this skill when you need to:
- Add argument parsing to shell scripts
- Support short and long options
- Validate argument values
- Generate help text
Generated Patterns
Getopts with Long Options
#!/usr/bin/env bash
VERBOSE=false
OUTPUT=""
FORMAT=
FORCE=
() {
<<
}
() {
arg ;
) -- ;;
) -- ;;
) -- ;;
) -- ;;
) -- ;;
*) -- ;;
OPTIND opt
opt;
h) usage; 0 ;;
v) VERBOSE= ;;
o) OUTPUT= ;;
f)
text|json|csv) FORMAT= ;;
*) die ;;
;;
F) FORCE= ;;
:) die ;;
\?) die ;;
$((OPTIND - ))
[[ -lt 1 ]];
usage
die
INPUT=
EXTRA_ARGS=()
}
() {
>&2
1
}
parse_options
[[ -f ]] || die
[[ -n && -f && != ]] && \
die