Skip to content

Commit

Permalink
Merge pull request #7163 from edolstra/misc-category
Browse files Browse the repository at this point in the history
Move some options into a misc category
  • Loading branch information
edolstra authored Oct 12, 2022
2 parents ae2d330 + eba6109 commit a6239eb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/libcmd/command.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ EvalCommand::EvalCommand()
{
addFlag({
.longName = "debugger",
.description = "start an interactive environment if evaluation fails",
.description = "Start an interactive environment if evaluation fails.",
.category = MixEvalArgs::category,
.handler = {&startReplOnEvalErrors, true},
});
}
Expand Down
2 changes: 0 additions & 2 deletions src/libcmd/common-eval-args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace nix {

MixEvalArgs::MixEvalArgs()
{
auto category = "Common evaluation options";

addFlag({
.longName = "arg",
.description = "Pass the value *expr* as the argument *name* to Nix functions.",
Expand Down
2 changes: 2 additions & 0 deletions src/libcmd/common-eval-args.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class Bindings;

struct MixEvalArgs : virtual Args
{
static constexpr auto category = "Common evaluation options";

MixEvalArgs();

Bindings * getAutoArgs(EvalState & state);
Expand Down
1 change: 1 addition & 0 deletions src/libmain/common-args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ MixCommonArgs::MixCommonArgs(const std::string & programName)
addFlag({
.longName = "option",
.description = "Set the Nix configuration setting *name* to *value* (overriding `nix.conf`).",
.category = miscCategory,
.labels = {"name", "value"},
.handler = {[](std::string name, std::string value) {
try {
Expand Down
1 change: 1 addition & 0 deletions src/libmain/common-args.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace nix {

//static constexpr auto commonArgsCategory = "Miscellaneous common options";
static constexpr auto loggingCategory = "Logging-related options";
static constexpr auto miscCategory = "Miscellaneous global options";

class MixCommonArgs : public virtual Args
{
Expand Down
4 changes: 4 additions & 0 deletions src/nix/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
addFlag({
.longName = "help",
.description = "Show usage information.",
.category = miscCategory,
.handler = {[&]() { throw HelpRequested(); }},
});

Expand All @@ -88,19 +89,22 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
addFlag({
.longName = "version",
.description = "Show version information.",
.category = miscCategory,
.handler = {[&]() { showVersion = true; }},
});

addFlag({
.longName = "offline",
.aliases = {"no-net"}, // FIXME: remove
.description = "Disable substituters and consider all previously downloaded files up-to-date.",
.category = miscCategory,
.handler = {[&]() { useNet = false; }},
});

addFlag({
.longName = "refresh",
.description = "Consider all previously downloaded files out-of-date.",
.category = miscCategory,
.handler = {[&]() { refresh = true; }},
});
}
Expand Down

0 comments on commit a6239eb

Please sign in to comment.