Factor out --json
This commit is contained in:
parent
9b63bb88c8
commit
66577a1c64
|
@ -12,7 +12,7 @@ struct MixCommonArgs : virtual Args
|
|||
|
||||
struct MixDryRun : virtual Args
|
||||
{
|
||||
bool dryRun;
|
||||
bool dryRun = false;
|
||||
|
||||
MixDryRun()
|
||||
{
|
||||
|
@ -20,4 +20,14 @@ struct MixDryRun : virtual Args
|
|||
}
|
||||
};
|
||||
|
||||
struct MixJSON : virtual Args
|
||||
{
|
||||
bool json = false;
|
||||
|
||||
MixJSON()
|
||||
{
|
||||
mkFlag(0, "json", "produce JSON output", &json);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -2,25 +2,24 @@
|
|||
#include "shared.hh"
|
||||
#include "store-api.hh"
|
||||
#include "json.hh"
|
||||
#include "common-args.hh"
|
||||
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace nix;
|
||||
|
||||
struct CmdPathInfo : StorePathsCommand
|
||||
struct CmdPathInfo : StorePathsCommand, MixJSON
|
||||
{
|
||||
bool showSize = false;
|
||||
bool showClosureSize = false;
|
||||
bool showSigs = false;
|
||||
bool json = false;
|
||||
|
||||
CmdPathInfo()
|
||||
{
|
||||
mkFlag('s', "size", "print size of the NAR dump of each path", &showSize);
|
||||
mkFlag('S', "closure-size", "print sum size of the NAR dumps of the closure of each path", &showClosureSize);
|
||||
mkFlag(0, "sigs", "show signatures", &showSigs);
|
||||
mkFlag(0, "json", "produce JSON output", &json);
|
||||
}
|
||||
|
||||
std::string name() override
|
||||
|
|
|
@ -7,13 +7,10 @@
|
|||
|
||||
using namespace nix;
|
||||
|
||||
struct CmdShowConfig : Command
|
||||
struct CmdShowConfig : Command, MixJSON
|
||||
{
|
||||
bool json = false;
|
||||
|
||||
CmdShowConfig()
|
||||
{
|
||||
mkFlag(0, "json", "produce JSON output", &json);
|
||||
}
|
||||
|
||||
std::string name() override
|
||||
|
|
Loading…
Reference in a new issue