diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2024-05-03 22:07:33 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@lix> | 2024-05-03 22:07:33 +0000 |
commit | f8617f9dc65096ee1e83fe3d100cc252e9f94bf6 (patch) | |
tree | 8fa920dfc179b9bb11411aa7fe98b75a5bdfc810 /src/nix | |
parent | 19645a4a6477f964ea4f53d1956e578a1ee15ecb (diff) | |
parent | 8458d98b274910e35baceda77f3e573817ed9f41 (diff) |
Merge "Rename `nix show-config` to `nix config show`" into main
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/config.cc (renamed from src/nix/show-config.cc) | 27 | ||||
-rw-r--r-- | src/nix/main.cc | 1 | ||||
-rw-r--r-- | src/nix/meson.build | 2 |
3 files changed, 26 insertions, 4 deletions
diff --git a/src/nix/show-config.cc b/src/nix/config.cc index 3530584f9..5b280d11d 100644 --- a/src/nix/show-config.cc +++ b/src/nix/config.cc @@ -7,11 +7,31 @@ using namespace nix; -struct CmdShowConfig : Command, MixJSON +struct CmdConfig : virtual NixMultiCommand +{ + CmdConfig() : MultiCommand(RegisterCommand::getCommandsFor({"config"})) + { } + + std::string description() override + { + return "manipulate the Nix configuration"; + } + + Category category() override { return catUtility; } + + void run() override + { + if (!command) + throw UsageError("'nix config' requires a sub-command."); + command->second->run(); + } +}; + +struct CmdConfigShow : Command, MixJSON { std::optional<std::string> name; - CmdShowConfig() { + CmdConfigShow() { expectArgs({ .label = {"name"}, .optional = true, @@ -56,4 +76,5 @@ struct CmdShowConfig : Command, MixJSON } }; -static auto rShowConfig = registerCommand<CmdShowConfig>("show-config"); +static auto rCmdConfig = registerCommand<CmdConfig>("config"); +static auto rShowConfig = registerCommand2<CmdConfigShow>({"config", "show"}); diff --git a/src/nix/main.cc b/src/nix/main.cc index 6bc46eba3..64755d445 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -151,6 +151,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs, virtual RootArgs {"ping-store", {"store", "ping"}}, {"sign-paths", {"store", "sign"}}, {"show-derivation", {"derivation", "show"}}, + {"show-config", {"config", "show"}}, {"to-base16", {"hash", "to-base16"}}, {"to-base32", {"hash", "to-base32"}}, {"to-base64", {"hash", "to-base64"}}, diff --git a/src/nix/meson.build b/src/nix/meson.build index cb8f73174..e41399b5d 100644 --- a/src/nix/meson.build +++ b/src/nix/meson.build @@ -59,7 +59,7 @@ nix_sources = files( 'repl.cc', 'run.cc', 'search.cc', - 'show-config.cc', + 'config.cc', 'sigs.cc', 'store-copy-log.cc', 'store-delete.cc', |