krader1961 · GitHub

I've been refactoring the src/builtin.cpp module by hoisting the implementation of each builtin command into its own module. For example, moving builtin_echo() to src/builtin_echo.cpp. This reminded me that the fish parser special-cases -h and --help if they are the only arguments to a command. This is dangerous and in my opinion wrong. For an example of why type echo -h. The -h should be echoed since it isn't a valid flag for that command. What actually happens is you get the echo man page. It also doesn't do the right thing if the user types cmd -h -h, cmd --help -h, etc. unless the actual implementation is correctly parsing the flags and those flags are valid for the command.

Read the original on github.com ↗