yellowman / nsh

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

remove support for 'continuation' completes from complete() #127

Closed stspdotname closed 1 year ago

stspdotname commented 1 year ago

This feature triggered when upper-case characters were given to the CMPL() macro. Its apparent purpose was to keep listing the same list of completions regardless of the current argument position in the command line. nsh was using this feature only for the '?' and 'help' commands, such that all of the following commands would provide help output:

help TAB help foo TAB help foo foo TAB help foo foo foo TAB etc.

With this change only the first argument to 'help' gets completed, which is consistent with how all other nsh commands behave:

help TAB

The intended purpose of above 'continuation' completions is unclear to me.

The help completion routines interpret upper/lower case for a different purpose: CMPL(H) results in a vertical display, while CMPL(h) results in a line-by-line display. I added that functionaliy before I learned about 'continuation' completions.

I would rather get rid of this virtually unused feature of the completion subsystem, as part of an effort to simplify the completion routines for future work (such as a 'tcpdump' command which will need more complicated completion logic than we have now).