This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

CLI autocomplete

Hey. Has anybody played with autocomplete for command line interface. I like it alot and it is very helpfull. Now a autocomplete would be cool!

Here is what comes to mind:

  • key as arrows and tab should be treated as return with the same text written again.

  • when is pressed we should compare our last argument with some kind of list.

  • when up and down arrows are pressed we should also go through some history list. I think 5 or 10 are enough.

Parents
  • User will have two macro types: one for creating "root command" and other for creating subcommands. We plan to ensure backward compatibility so either root command can have a handler as it is now or sub commands can have it. Console will execute deepest handler which will be found.

    As an example you can have command: "log enable SPI" where:

    • log (root command): can have handler or not
    • enable (sub command of log): can have handler or not
    • SPI (sub command of enable): can have handler or not.

    So you can either implement very complex handler for "log" to detect "enable" and next "SPI" or less complex handler for "enable" to detect "SPI" or you can implement only a simple handler for "SPI".

Reply
  • User will have two macro types: one for creating "root command" and other for creating subcommands. We plan to ensure backward compatibility so either root command can have a handler as it is now or sub commands can have it. Console will execute deepest handler which will be found.

    As an example you can have command: "log enable SPI" where:

    • log (root command): can have handler or not
    • enable (sub command of log): can have handler or not
    • SPI (sub command of enable): can have handler or not.

    So you can either implement very complex handler for "log" to detect "enable" and next "SPI" or less complex handler for "enable" to detect "SPI" or you can implement only a simple handler for "SPI".

Children
No Data
Related