Last active
November 26, 2020 15:32
-
-
Save rasmusmerzin/b570532c7cc15f1feeeb46a1fb2aa9eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo '## Operators' | |
"$@" help | awk ' | |
BEGIN { | |
doprint = 0 | |
} | |
/^\s*$/ { | |
doprint = 0 | |
} | |
{ | |
if (doprint) print $1 | |
} | |
/SUBCOMMANDS/ { | |
doprint = 1 | |
} | |
' | while read -r operator | |
do | |
printf '\n### %s\n' "$operator" | |
"$@" help "$operator" | awk ' | |
{ | |
switch (NR) { | |
case 1: break | |
case 2: | |
print "\n"$0"\n" | |
break | |
default: | |
if (length($0) > 0) | |
print " "$0 | |
} | |
} | |
' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment