mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-29 13:22:27 +03:00
18 lines
408 B
Bash
Executable File
18 lines
408 B
Bash
Executable File
#!/bin/bash
|
|
# Output short and long options from man/usage text
|
|
|
|
set -o errexit -o pipefail -o nounset
|
|
|
|
main() {
|
|
declare tmp
|
|
tmp=$(mktemp)
|
|
cat > "$tmp"
|
|
sed -rn 's/.* (-[a-zA-Z0-9]).*/\1/gp' < "$tmp"
|
|
|
|
# Do not print '=' after long options with arg because it makes completion
|
|
# for option arguments harder.
|
|
sed -rn 's/.* (--[a-zA-Z][-_a-zA-Z0-9]*)=?.*/\1/gp' < "$tmp"
|
|
}
|
|
|
|
main "$@"
|