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

Merge pull request #13500 from NixOS/mergify/bp/2.30-maintenance/pr-13496

Fix `nix help shell` by properly handling command aliases (backport #13496)
This commit is contained in:
Jörg Thalheim 2025-07-17 20:47:03 +02:00 committed by GitHub
commit 7f5709c012
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. */
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));
evalSettings.restrictEval = false;