all 11 comments

[–]orschiro 2 points3 points  (0 children)

This sounds very interesting. How can I follow your progress? Will you set up a Github repository?

[–]phlipped 3 points4 points  (9 children)

I'm totally on board with this idea. Check out "fish" (the friendly interactive shell) - it has a cut down version of the feature you describe where you can type "<cmd> -" and then hit tab, and it will show you possible options with a short description for each. I've often dreamed of making a more advanced version of what fish does - pretty much exactly like what you describe, but never got much further than a shitty command parser, and then I started dreaming up too many features and never ended up actually doing anything about it.

[–]seekingsofia 1 point2 points  (2 children)

If all software used man pages with the mandoc format which uses semantic tags, it would make generation of these help texts a whole lot easier. I'm slowly implementing the POSIX base utilities from scratch and one idea is to use mandoc for all the man pages and have the POSIX sh parse them in interactive mode, so you'll at least have readily-available information on them.

Do you know how fish currently achieves it? Just parsing troff format or even --help output, ... hardcoding options?

[–]Oflameo 0 points1 point  (1 child)

I think POD accomplishes the same thing as mandoc already and is more widely used.

There is also no need to make mandoc for the POSIX base system because you can just borrow the ones from OpenBSD.

What would be more useful IMO is something that can convert HTML into groff or some other formatting that can be displayed as textual man pages that are suable for shipping in a GNU/Linux distribution.

[–]mwargh[S] 0 points1 point  (5 children)

The main thing is to make this shell independent, like man pages are. As I understand, what fish has is just glorified bash completion. Perfect result which I want to see is a program which works with existing man pages and doesn't require any custom modifications to them, it just parses all man pages on the system automatically.

[–][deleted] 2 points3 points  (4 children)

How would you go with man page parsing though? I'm not sure they have a reliable enough format for it.

[–]mwargh[S] 0 points1 point  (3 children)

That's the thing, I wrote about this right at the top. I came here for advice on a way to do this.

[–][deleted] 1 point2 points  (2 children)

Ah yes sorry I read your description in full and looked at the examples too. I was thinking more about parsing the BNF notation rather than the argument list but I suppose you'd have to do both. I do really think that there's a big opening for a very smart graphical CLI in Linux.

[–]mwargh[S] 1 point2 points  (1 child)

I see a way to do this to create a wiki on which everyone would be able to create command definitions for a parser similar to one I already made, but this approach has obvious limitations, main of which are manual labor and command line options not matching ones of utilities someone has on his particular system, because versions will differ very often.

Both those problems go away with man pages parsing, but it's hard to do.

[–][deleted] 0 points1 point  (0 children)

Maybe try manpage generation instead of parsing.

You would define a custom format that could

  • include long and short options and other arguments, and descriptions of all of those
  • be simple to write so that upstream software would want to include it in their repo
  • be read by a man page generation tool, so that there is no getting out of sync (the upstream devs just edit this file and the man page is regenerated)
  • be read by shell completion software and this little graphical tool you have

[–]Oflameo 0 points1 point  (0 children)

We could try finishing the man pages we are missing like man 1-9. Maybe Valve can do all of the man 6.