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