Skip to content

Commit 599c1d7

Browse files
authored
Merge pull request #13496 from k1gen/fix-help-shell-command
Fix `nix help shell` by properly handling command aliases
2 parents 4c95086 + d678b07 commit 599c1d7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/nix/main.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,14 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs, virtual RootArgs
212212
lowdown. */
213213
static void showHelp(std::vector<std::string> subcommand, NixArgs & toplevel)
214214
{
215+
// Check for aliases if subcommand has exactly one element
216+
if (subcommand.size() == 1) {
217+
auto alias = toplevel.aliases.find(subcommand[0]);
218+
if (alias != toplevel.aliases.end()) {
219+
subcommand = alias->second.replacement;
220+
}
221+
}
222+
215223
auto mdName = subcommand.empty() ? "nix" : fmt("nix3-%s", concatStringsSep("-", subcommand));
216224

217225
evalSettings.restrictEval = false;

0 commit comments

Comments
 (0)