aboutsummaryrefslogtreecommitdiff
path: root/src/libmain
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-03-28 23:22:10 +0000
committerJohn Ericson <git@JohnEricson.me>2020-03-29 11:23:15 -0400
commit87b32bab05ff91981c8847d66cd5502feb44f3b5 (patch)
treeff77f6703185a8b9544f354de5853254ef88a4d8 /src/libmain
parenteb1911e277bfcc1b161cb996205ae1696f496099 (diff)
Use `enum struct` and drop prefixes
This does a few enums; the rest will be gotten in subsequent commits.
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/common-args.cc8
-rw-r--r--src/libmain/shared.cc2
-rw-r--r--src/libmain/shared.hh4
3 files changed, 8 insertions, 6 deletions
diff --git a/src/libmain/common-args.cc b/src/libmain/common-args.cc
index 9e1d7cee6..9c873e22a 100644
--- a/src/libmain/common-args.cc
+++ b/src/libmain/common-args.cc
@@ -10,17 +10,19 @@ MixCommonArgs::MixCommonArgs(const string & programName)
.longName("verbose")
.shortName('v')
.description("increase verbosity level")
- .handler([]() { verbosity = (Verbosity) (verbosity + 1); });
+ .handler([]() { verbosity = (Verbosity) ((uint64_t) verbosity + 1); });
mkFlag()
.longName("quiet")
.description("decrease verbosity level")
- .handler([]() { verbosity = verbosity > lvlError ? (Verbosity) (verbosity - 1) : lvlError; });
+ .handler([]() { verbosity = verbosity > Verbosity::Error
+ ? (Verbosity) ((uint64_t) verbosity - 1)
+ : Verbosity::Error; });
mkFlag()
.longName("debug")
.description("enable debug output")
- .handler([]() { verbosity = lvlDebug; });
+ .handler([]() { verbosity = Verbosity::Debug; });
mkFlag()
.longName("option")
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index d41e772e9..79e35eedc 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -251,7 +251,7 @@ void parseCmdLine(const string & programName, const Strings & args,
void printVersion(const string & programName)
{
std::cout << format("%1% (Nix) %2%") % programName % nixVersion << std::endl;
- if (verbosity > lvlInfo) {
+ if (verbosity > Verbosity::Info) {
Strings cfg;
#if HAVE_BOEHMGC
cfg.push_back("gc");
diff --git a/src/libmain/shared.hh b/src/libmain/shared.hh
index b49574652..96d001ec3 100644
--- a/src/libmain/shared.hh
+++ b/src/libmain/shared.hh
@@ -43,11 +43,11 @@ struct StorePathWithOutputs;
void printMissing(
ref<Store> store,
const std::vector<StorePathWithOutputs> & paths,
- Verbosity lvl = lvlInfo);
+ Verbosity lvl = Verbosity::Info);
void printMissing(ref<Store> store, const StorePathSet & willBuild,
const StorePathSet & willSubstitute, const StorePathSet & unknown,
- unsigned long long downloadSize, unsigned long long narSize, Verbosity lvl = lvlInfo);
+ unsigned long long downloadSize, unsigned long long narSize, Verbosity lvl = Verbosity::Info);
string getArg(const string & opt,
Strings::iterator & i, const Strings::iterator & end);