getopt: use long argument for --options

feature/windows-fix-syntax-2
Emily Grace Seville 2021-11-23 01:04:35 +10:00 committed by GitHub
parent b39cdcc602
commit a22424ffdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -5,16 +5,16 @@
- Parse optional `verbose`/`version` flags with shorthands:
`getopt -o vV --longoptions verbose,version -- --version --verbose`
`getopt --options vV --longoptions verbose,version -- --version --verbose`
- Add a `--file` option with a required argument with shorthand `-f`:
`getopt -o f: --longoptions file: -- --file=somefile`
`getopt --options f: --longoptions file: -- --file=somefile`
- Add a `--verbose` option with an optional argument with shorthand `-v`, and pass a non-option parameter `arg`:
`getopt -o v:: --longoptions verbose:: -- --verbose arg`
`getopt --options v:: --longoptions verbose:: -- --verbose arg`
- Accept a `-r` and `--verbose` flag, a `--accept` option with an optional argument and add a `--target` with a required argument option with shorthands:
`getopt -o rv::s::t: --longoptions verbose,source::,target: -- -v --target target`
`getopt --options rv::s::t: --longoptions verbose,source::,target: -- -v --target target`