mirror of
https://github.com/NixOS/nix
synced 2025-07-05 08:11:47 +02:00
* Debug levels. Use `--verbose / -v LEVEL' to display only messages
up to the given verbosity levels. These currently are: lvlError = 0, lvlNormal = 5, lvlDebug = 10, lvlDebugMore = 15 although only lvlError and lvlDebug are actually used right now.
This commit is contained in:
parent
b75719b984
commit
1a7468a57a
8 changed files with 68 additions and 25 deletions
16
src/nix.cc
16
src/nix.cc
|
@ -1,4 +1,5 @@
|
|||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "globals.hh"
|
||||
#include "normalise.hh"
|
||||
|
@ -278,10 +279,9 @@ void run(Strings args)
|
|||
Strings opFlags, opArgs;
|
||||
Operation op = 0;
|
||||
|
||||
for (Strings::iterator it = args.begin();
|
||||
it != args.end(); it++)
|
||||
for (Strings::iterator it = args.begin(); it != args.end(); )
|
||||
{
|
||||
string arg = *it;
|
||||
string arg = *it++;
|
||||
|
||||
Operation oldOp = op;
|
||||
|
||||
|
@ -307,6 +307,16 @@ void run(Strings args)
|
|||
op = opVerify;
|
||||
else if (arg == "--path" || arg == "-p")
|
||||
pathArgs = true;
|
||||
else if (arg == "--verbose" || arg == "-v") {
|
||||
if (it == args.end()) throw UsageError(
|
||||
format("`%1%' requires an argument") % arg);
|
||||
istringstream str(*it++);
|
||||
int lvl;
|
||||
str >> lvl;
|
||||
if (str.fail()) throw UsageError(
|
||||
format("`%1%' requires an integer argument") % arg);
|
||||
verbosity = (Verbosity) lvl;
|
||||
}
|
||||
else if (arg[0] == '-')
|
||||
opFlags.push_back(arg);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue