diff options
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', |