[Feature] Implement command line parser builtin
- Linguagem predominante
- Rust
- Estrelas
- 5.2k
- Forks
- 145
- Merge médio
- 5d 3h
- PRs com merge (30d)
- 7
Descrição
**Is your feature request related to a problem? Please describe.**
When writing Bash scripts taking command line options, I use `getopt` to preprocess the command line, and a `while` loop and `case` statement to handle individual options:
```
#!/usr/bin/env bash
# Parse command line or print help text.
script=""
files=()
title=""
items=()
depth=0
ultra=0
verbose=0
getopt=$(getopt --options=t:i:d:uv --longoptions=title:,items:,depth:,ultra,verbose,help -- "$@") || exit
eval set -- $getopt
while true; do
case "$1" in
-t|--title)
title="$2"
shift
shift
;;
-i|--items)
items+=("$2")
shift
shift
;;
-d|--depth)
depth="$2"
shift
shift
;;
-u|--ultra)
ultra=1
shift
;;
-v|--verbose)
verbose=1
shift
;;
--help)
cat <
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Avaliação
Esta issue ainda não foi avaliada.