Anyone know of a reverse command script or package to parse args for flags, expand them, and condense a man or help page(s) to just the relevant flags?

I have been working on my scripts for user/group permissions today. This idea has been on my back burner for awhile. I’m sure others have done this before. I just haven’t encountered them yet.

I was thinking of just trying to find the flags where they start a line and put everything in a string array until the next line that starts with a flag. Then I would just call the script with the command, a loop would match the flags and print the matches.

BuoyantCitrus,
inspxtr,

omg that is lovely. Kinda like regex101.com for regular expressions.

learnbyexample,
@learnbyexample@programming.dev avatar

Inspired by explainshell, I wrote a script (github.com/learnbyexample/command_help) to be used from the terminal itself. It is a bit buggy, but works well most of the time. For example:


<span style="color:#323232;">$ ch grep -Ao
</span><span style="color:#323232;">       grep - print lines that match patterns
</span><span style="color:#323232;">
</span><span style="color:#323232;">       -A NUM, --after-context=NUM
</span><span style="color:#323232;">              Print NUM lines of trailing context after matching lines.  Places a
</span><span style="color:#323232;">              line containing a group separator (--) between contiguous groups of
</span><span style="color:#323232;">              matches.  With the -o or --only-matching option, this has no effect
</span><span style="color:#323232;">              and a warning is given.
</span><span style="color:#323232;">
</span><span style="color:#323232;">       -o, --only-matching
</span><span style="color:#323232;">              Print  only  the matched (non-empty) parts of a matching line, with
</span><span style="color:#323232;">              each such part on a separate output line.
</span>
  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • fightinggames
  • All magazines