1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-27 12:41:00 +01:00

Use enum struct and drop prefixes

This does a few enums; the rest will be gotten in subsequent commits.
This commit is contained in:
John Ericson 2020-03-28 23:22:10 +00:00 committed by John Ericson
parent eb1911e277
commit 87b32bab05
57 changed files with 382 additions and 354 deletions

View file

@ -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")

View file

@ -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");

View file

@ -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);