Some fixes in hledger help output parsing
This commit is contained in:
parent
bc7a1476ed
commit
550f47b3fa
@ -7,7 +7,7 @@ hledger-completion.bash: hledger-completion.bash.m4 commands-list.txt query-filt
|
||||
m4 hledger-completion.bash.m4 > $@
|
||||
|
||||
generic-options.txt:
|
||||
hledger -h | ./output-options.sh > $@
|
||||
hledger -h | ./output-options.sh | sort -u > $@
|
||||
|
||||
commands.txt:
|
||||
hledger | ./output-commands.sh | grep -v ^hledger > $@
|
||||
@ -20,7 +20,8 @@ commands-list.txt: commands.txt
|
||||
# hledger help --cat hledger | sed -n '/^QUERIES/,/^[A-Z]/p'
|
||||
|
||||
command-options: commands.txt
|
||||
parallel -j8 'hledger {} -h | ./output-options.sh > options-{}.txt' < commands.txt
|
||||
parallel -j8 'hledger {} -h | ./output-options.sh | sort -u > options-{}.txt' < commands.txt
|
||||
|
||||
clean:
|
||||
rm -f *.txt hledger-completion.bash
|
||||
rm -f commands*.txt generic-options.txt options-*.txt
|
||||
rm -f hledger-completion.bash
|
||||
|
||||
@ -8,9 +8,12 @@ main() {
|
||||
tmp=$(mktemp)
|
||||
cat > "$tmp"
|
||||
|
||||
sed -rn 's/^ ([-a-z]+).*/\1/gp' "$tmp"
|
||||
# Do not output mistaken commands that start with a dash (e.g. -h)
|
||||
sed -rn 's/^ ([-a-z]+).*/\1/gp' "$tmp" \
|
||||
| grep -v ^-
|
||||
|
||||
# Do not output single letter commands, it's not useful.
|
||||
# Output single command aliases in parenthesis:
|
||||
# Do not output single letter command aliases, it's not useful.
|
||||
sed -rn 's/^ .*\(([a-z]+)\).*/\1/gp' "$tmp" \
|
||||
| grep -v ^.$
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user