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

Merge pull request #13499 from NixOS/mergify/bp/2.28-maintenance/pr-13496

Fix `nix help shell` by properly handling command aliases (backport #13496)
This commit is contained in:
mergify[bot] 2025-07-17 18:26:33 +00:00 committed by GitHub
commit 65f435708a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -245,6 +245,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;