forked from lix-project/lix
Fix nix-repl does not support '--help'
According to popular practice and convention `nix-repl` now supports `--help` like a good POSIX citizen[1]. [1] https://www.gnu.org/prep/standards/html_node/Command_002dLine-Interfaces.html
This commit is contained in:
parent
45c6405a30
commit
57aeef0b6a
1 changed files with 7 additions and 1 deletions
|
@ -59,7 +59,8 @@ struct NixRepl
|
|||
|
||||
void printHelp()
|
||||
{
|
||||
std::cout << "Usage: nix-repl\n";
|
||||
std::cout << "Usage: nix-repl [--help|--version]";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -601,6 +602,11 @@ int main(int argc, char * * argv)
|
|||
parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) {
|
||||
if (*arg == "--version")
|
||||
printVersion("nix-repl");
|
||||
else if (*arg == "--help") {
|
||||
printHelp();
|
||||
// exit with 0 since user asked for help
|
||||
_exit(0);
|
||||
}
|
||||
else if (parseSearchPathArg(arg, end, searchPath))
|
||||
;
|
||||
else if (*arg != "" && arg->at(0) == '-')
|
||||
|
|
Loading…
Reference in a new issue