diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2020-06-19 14:40:49 -0400 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2020-06-19 14:40:49 -0400 |
commit | 7e11cf339988a1b44bbd59377de2a1585387ac83 (patch) | |
tree | cdce4ecf309a84408b4e3952daa7f78c9b825f5b /src/nix/hash.cc | |
parent | 2796b01e863bf3a6d28cc89bb46c6388d8b73fbc (diff) | |
parent | 984e521392b3f41f7cdab203e5c00f3e00e27a28 (diff) |
Merge remote-tracking branch 'origin/master' into substitute-other-storedir
Diffstat (limited to 'src/nix/hash.cc')
-rw-r--r-- | src/nix/hash.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/nix/hash.cc b/src/nix/hash.cc index 0dd4998d9..f435192fc 100644 --- a/src/nix/hash.cc +++ b/src/nix/hash.cc @@ -79,12 +79,12 @@ static RegisterCommand r2("hash-path", [](){ return make_ref<CmdHash>(FileIngest struct CmdToBase : Command { Base base; - HashType ht = htUnknown; + std::optional<HashType> ht; std::vector<std::string> args; CmdToBase(Base base) : base(base) { - addFlag(Flag::mkHashTypeFlag("type", &ht)); + addFlag(Flag::mkHashTypeOptFlag("type", &ht)); expectArgs("strings", &args); } @@ -132,8 +132,6 @@ static int compatNixHash(int argc, char * * argv) else if (*arg == "--type") { string s = getArg(*arg, arg, end); ht = parseHashType(s); - if (ht == htUnknown) - throw UsageError("unknown hash type '%1%'", s); } else if (*arg == "--to-base16") op = opTo16; else if (*arg == "--to-base32") op = opTo32; |