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

Conversation

detroyejr
Copy link
Contributor

Motivation

Allow both nix store optimise and nix store optimize.

Context

Closes #11326

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@github-actions github-actions bot added the new-cli Relating to the "nix" command label Sep 24, 2024
@Mic92 Mic92 requested a review from tomberek September 24, 2024 05:20
@@ -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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-cli Relating to the "nix" command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alias nix store optimize to nix store optimise
2 participants