Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optimize as an alias of optimise #11577

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/nix/optimise-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ struct CmdOptimiseStore : StoreCommand
};

static auto rCmdOptimiseStore = registerCommand2<CmdOptimiseStore>({"store", "optimise"});
static auto rCmdOptimizeStore = registerCommand2<CmdOptimiseStore>({"store", "optimize"});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Not commenting on whether we want American-spelling aliases for commands.)

The correct way to create an alias is to add it aliases in src/nix/main.cc. That way it doesn't duplicate manpages etc., and there is one "canonical" spelling.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thanks for pointing me in the right direction.

On first glance an alias like this would work (nix optimize -> nix store optimise)

{"optimize", { AliasStatus::AcceptedShorthand, {"store", "optimise"}}},

but neither of these do intending nix store optimise -> nix store optimize:

{"store optimize", { AliasStatus::AcceptedShorthand, {"store", "optimise"}}},
{"optimize", { AliasStatus::AcceptedShorthand, {"optimise"}}},

Seems to be because rewriteArgs expects a one-word command (unless you quote the argument) and doesn't modify the sub-command. I'll see if I can figure something else out.

Loading