Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing manual pages for auto-completion #13

Closed
dundalek opened this issue Nov 3, 2017 · 4 comments
Closed

Parsing manual pages for auto-completion #13

dundalek opened this issue Nov 3, 2017 · 4 comments

Comments

@dundalek
Copy link
Owner

dundalek commented Nov 3, 2017

This is not an immediate concern but I am creating an issue for discussion and to collect currently existing approaches and maybe for someone to take a stab at it.

Parsing manual pages is a messy business since there is no single standard and there are many slight variations.

Existing approaches:

  • Only project I am currently aware to attempt this is fish with fish_update_completions (source here).
  • Other project is explainshell but it does not handle command grammars so it is not a suitable approach (it could generate invalid suggestions).

What I imagine:

  • If completion definitions for a command are not available then try to parse man command or command --help or command -h
  • There are many variations so using a high-level parsing library like Instaparse is preferred. We can define different variant of parsing rules and reuse the common rules.
  • Docopt seems to be most formal description of command line arguments, so it makes sense to start with parsing its format, then extend to other manual pages in the wild.
@millettjon
Copy link

Something like compleat but in clojure would be useful.

@millettjon
Copy link

Could spec be used to generate completions?

@dundalek
Copy link
Owner Author

Compleat looks neat, but it does not have a repository of completions so I don't see much value in integrating it.

I once played with using spec to parse argument for a CLI app and I think its doable. Once you have a spec it should be possible to write a completion generator for it. It's a kind of a long shot though.

@dundalek
Copy link
Owner Author

Not going to be working on this anytime soon, closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants