forked from lix-project/lix
Support --no-net for backwards compatibility
This commit is contained in:
parent
480426a364
commit
37352aa7e1
|
@ -14,6 +14,8 @@ void Args::addFlag(Flag && flag_)
|
||||||
assert(flag->handler.arity == flag->labels.size());
|
assert(flag->handler.arity == flag->labels.size());
|
||||||
assert(flag->longName != "");
|
assert(flag->longName != "");
|
||||||
longFlags[flag->longName] = flag;
|
longFlags[flag->longName] = flag;
|
||||||
|
for (auto & alias : flag->aliases)
|
||||||
|
longFlags[alias] = flag;
|
||||||
if (flag->shortName) shortFlags[flag->shortName] = flag;
|
if (flag->shortName) shortFlags[flag->shortName] = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,6 +193,7 @@ nlohmann::json Args::toJSON()
|
||||||
|
|
||||||
for (auto & [name, flag] : longFlags) {
|
for (auto & [name, flag] : longFlags) {
|
||||||
auto j = nlohmann::json::object();
|
auto j = nlohmann::json::object();
|
||||||
|
if (flag->aliases.count(name)) continue;
|
||||||
if (flag->shortName)
|
if (flag->shortName)
|
||||||
j["shortName"] = std::string(1, flag->shortName);
|
j["shortName"] = std::string(1, flag->shortName);
|
||||||
if (flag->description != "")
|
if (flag->description != "")
|
||||||
|
|
|
@ -97,6 +97,7 @@ protected:
|
||||||
typedef std::shared_ptr<Flag> ptr;
|
typedef std::shared_ptr<Flag> ptr;
|
||||||
|
|
||||||
std::string longName;
|
std::string longName;
|
||||||
|
std::set<std::string> aliases;
|
||||||
char shortName = 0;
|
char shortName = 0;
|
||||||
std::string description;
|
std::string description;
|
||||||
std::string category;
|
std::string category;
|
||||||
|
|
|
@ -92,6 +92,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
|
||||||
|
|
||||||
addFlag({
|
addFlag({
|
||||||
.longName = "offline",
|
.longName = "offline",
|
||||||
|
.aliases = {"no-net"}, // FIXME: remove
|
||||||
.description = "Disable substituters and consider all previously downloaded files up-to-date.",
|
.description = "Disable substituters and consider all previously downloaded files up-to-date.",
|
||||||
.handler = {[&]() { useNet = false; }},
|
.handler = {[&]() { useNet = false; }},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue