Update cheatsheets

This commit is contained in:
ivuorinen
2025-03-27 00:18:38 +00:00
parent 5871f35fe8
commit 9fe6559a97
123 changed files with 660 additions and 357 deletions

View File

@@ -6,20 +6,20 @@ source: https://github.com/tldr-pages/tldr.git
# getopt
> Parse command-line arguments.
> More information: <https://www.gnu.org/software/libc/manual/html_node/Getopt.html>.
> More information: <https://manned.org/getopt>.
- Parse optional `verbose`/`version` flags with shorthands:
`getopt --options vV --longoptions verbose,version -- --version --verbose`
`getopt {{[-o|--options]}} vV {{[-l|--longoptions]}} verbose,version -- --version --verbose`
- Add a `--file` option with a required argument with shorthand `-f`:
`getopt --options f: --longoptions file: -- --file=somefile`
`getopt {{[-o|--options]}} f: {{[-l|--longoptions]}} file: -- --file=somefile`
- Add a `--verbose` option with an optional argument with shorthand `-v`, and pass a non-option parameter `arg`:
`getopt --options v:: --longoptions verbose:: -- --verbose arg`
`getopt {{[-o|--options]}} v:: {{[-l|--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 --options rv::s::t: --longoptions verbose,source::,target: -- -v --target target`
`getopt {{[-o|--options]}} rv::s::t: {{[-l|--longoptions]}} verbose,source::,target: -- -v --target target`