diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-06-18 22:33:07 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-06-18 22:33:07 +0000 |
commit | 669c3992e883414269d850bba5f00c59a1b207d0 (patch) | |
tree | 3ab30069748da1ab1383632e3e17a58d605dc898 /src/nix/hash.cc | |
parent | 517f5980e2c63af47e7042873cc33b521918ad35 (diff) | |
parent | 15abb2aa2ba7de06a86e05511f81633616e17d87 (diff) |
Merge branch 'no-hash-type-unknown' into validPathInfo-temp
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; |