Whats: A CLI command explainer, pure man pages, –help outputs

thunderbong2 pts1 comments

GitHub - iamkaran/whats: A cli command explainer, pure man pages, --help outputs · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

iamkaran

whats

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star<br>36

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>14 Commits<br>14 Commits

.gitignore

.gitignore

LICENSE

LICENSE

README.md

README.md

flag_test.go

flag_test.go

go.mod

go.mod

whats.go

whats.go

View all files

Repository files navigation

whats

A simple cli utility that explains commands using man pages and help text

usage

add a whats in the front of any command

, --message= Use as the commit message. If multiple -m options are given,...

$ whats ls -lahrt<br>-l use a long listing format...<br>-a, --all do not ignore entries starting with .<br>-h, --human-readable with -l and -s, print sizes like 1K 234M 2G etc.<br>-r, --reverse reverse order while sorting...<br>-t sort by time, newest first; see --time...">$ whats git commit -m "foo"<br>commit Record changes to the repository..:<br>-m , --message= Use as the commit message. If multiple -m options are given,...

$ whats ls -lahrt<br>-l use a long listing format...<br>-a, --all do not ignore entries starting with .<br>-h, --human-readable with -l and -s, print sizes like 1K 234M 2G etc.<br>-r, --reverse reverse order while sorting...<br>-t sort by time, newest first; see --time...

how it works

Regex pattern matches the common format of flags in man pages and --help outputs:

-I, --ignore=PATTERN<br>do not list implied entries matching shell PATTERN

Which includes the flag line starting with a indent followed by the first flag starting with one or two dashes and then the additional flags separated with a comma or pipe plus a argument hint (=PATTERN).<br>Description of sub commands are found by parsing common forms of help text for example man cmd-subcmd example: man git-commit and these man pages are validated by checking if the synopsis agrees on it being an actual sub command rather than an actual command by the name cmd-subcmd.

--help/help is used as a fallback

Note<br>Some may complain using regex results in the program being rigid about finding the description but it is the most reliable way right now. (I know man pages can be parsed directly out of their files but every tool likes to be unique about their way of writing it so its better to target the only common thing in all of them which is the format of writing flags/subcommands and their descriptions itself)

installation

go install github.com/iamkaran/whats@latest

or

git clone https://github.com/iamkaran/whats.git<br>cd whats/<br>go build

About<br>A cli command explainer, pure man pages, --help outputs<br>Topics<br>clicommand-linegolangtoolsutility<br>Resources<br>Readme<br>GPL-3.0 license<br>Activity<br>Stars<br>36 stars<br>Watchers<br>3 watching<br>Forks<br>0 forks<br>Report repository

Releases

Used by

Contributors

Languages

You can’t perform that action at this time.

whats help commit pages command message

Related Articles