Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 480426a364f0
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 37352aa7e19e
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Feb 7, 2021

  1. Copy the full SHA
    37352aa View commit details
Showing with 5 additions and 0 deletions.
  1. +3 −0 src/libutil/args.cc
  2. +1 −0 src/libutil/args.hh
  3. +1 −0 src/nix/main.cc
3 changes: 3 additions & 0 deletions src/libutil/args.cc
Original file line number Diff line number Diff line change
@@ -14,6 +14,8 @@ void Args::addFlag(Flag && flag_)
assert(flag->handler.arity == flag->labels.size());
assert(flag->longName != "");
longFlags[flag->longName] = flag;
for (auto & alias : flag->aliases)
longFlags[alias] = flag;
if (flag->shortName) shortFlags[flag->shortName] = flag;
}

@@ -191,6 +193,7 @@ nlohmann::json Args::toJSON()

for (auto & [name, flag] : longFlags) {
auto j = nlohmann::json::object();
if (flag->aliases.count(name)) continue;
if (flag->shortName)
j["shortName"] = std::string(1, flag->shortName);
if (flag->description != "")
1 change: 1 addition & 0 deletions src/libutil/args.hh
Original file line number Diff line number Diff line change
@@ -97,6 +97,7 @@ protected:
typedef std::shared_ptr<Flag> ptr;

std::string longName;
std::set<std::string> aliases;
char shortName = 0;
std::string description;
std::string category;
1 change: 1 addition & 0 deletions src/nix/main.cc
Original file line number Diff line number Diff line change
@@ -92,6 +92,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs

addFlag({
.longName = "offline",
.aliases = {"no-net"}, // FIXME: remove
.description = "Disable substituters and consider all previously downloaded files up-to-date.",
.handler = {[&]() { useNet = false; }},
});