1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 03:56:01 +01:00

Merge pull request #13496 from k1gen/fix-help-shell-command

Fix `nix help shell` by properly handling command aliases
This commit is contained in:
Jörg Thalheim 2025-07-17 19:40:47 +02:00 committed by GitHub
commit 599c1d78ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -212,6 +212,14 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs, virtual RootArgs
lowdown. */ lowdown. */
static void showHelp(std::vector<std::string> subcommand, NixArgs & toplevel) static void showHelp(std::vector<std::string> subcommand, NixArgs & toplevel)
{ {
// Check for aliases if subcommand has exactly one element
if (subcommand.size() == 1) {
auto alias = toplevel.aliases.find(subcommand[0]);
if (alias != toplevel.aliases.end()) {
subcommand = alias->second.replacement;
}
}
auto mdName = subcommand.empty() ? "nix" : fmt("nix3-%s", concatStringsSep("-", subcommand)); auto mdName = subcommand.empty() ? "nix" : fmt("nix3-%s", concatStringsSep("-", subcommand));
evalSettings.restrictEval = false; evalSettings.restrictEval = false;