yellowman / nsh

OpenBSD networking configuration shell
http://www.nmedia.net/nsh/
Other
174 stars 27 forks source link

implement tab completion for ip sysctl commands #120

Closed stspdotname closed 1 year ago

stspdotname commented 1 year ago

Tweak the help completion engine to display a help text next to items on the completion list if not in vertical mode. This makes the setting of sysctls easier because valid inputs are displayed alongside help information when the tab key is pressed.

stspdotname commented 1 year ago

Above force-push fixes an issue pointed by out Tom where the boolean parameters were completed with 0 / 1 arguments which is in fact invalid syntax. E.g. instead of "ip carp 0" the user needs to type "no ip carp".

Since adding "no" at the beginning of the prompt won't work well with automatic completion I have added a mechanism to provide literal help strings that will be printed as-is, so even complex commands can be shown where needed. These won't auto-complete but still provide guidance to users at run-time. We can use these wherever it makes sense. This works well enough from my point of view.

stspdotname commented 1 year ago

By the way, "no ip carp TAB" does not work here but will start working once PR 118 is merged which has the fix for this issue.

stspdotname commented 1 year ago

Above force-push rebased this patch to include the fix from PR 118.

smytht commented 1 year ago

tested works as expected found an issue with ip esp and ip ipsec-pfs created a bug in the todo list for these items... im happy to merge this big improvement in usability into nsh