aboutsummaryrefslogtreecommitdiff
path: root/src/nix/hash.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/hash.cc')
-rw-r--r--src/nix/hash.cc26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/nix/hash.cc b/src/nix/hash.cc
index af4105e28..1b3ba729e 100644
--- a/src/nix/hash.cc
+++ b/src/nix/hash.cc
@@ -26,11 +26,6 @@ struct CmdHash : Command
expectArgs("paths", &paths);
}
- std::string name() override
- {
- return mode == mFile ? "hash-file" : "hash-path";
- }
-
std::string description() override
{
return mode == mFile
@@ -49,8 +44,8 @@ struct CmdHash : Command
}
};
-static RegisterCommand r1(make_ref<CmdHash>(CmdHash::mFile));
-static RegisterCommand r2(make_ref<CmdHash>(CmdHash::mPath));
+static RegisterCommand r1("hash-file", [](){ return make_ref<CmdHash>(CmdHash::mFile); });
+static RegisterCommand r2("hash-path", [](){ return make_ref<CmdHash>(CmdHash::mPath); });
struct CmdToBase : Command
{
@@ -66,15 +61,6 @@ struct CmdToBase : Command
expectArgs("strings", &args);
}
- std::string name() override
- {
- return
- base == Base16 ? "to-base16" :
- base == Base32 ? "to-base32" :
- base == Base64 ? "to-base64" :
- "to-sri";
- }
-
std::string description() override
{
return fmt("convert a hash to %s representation",
@@ -91,10 +77,10 @@ struct CmdToBase : Command
}
};
-static RegisterCommand r3(make_ref<CmdToBase>(Base16));
-static RegisterCommand r4(make_ref<CmdToBase>(Base32));
-static RegisterCommand r5(make_ref<CmdToBase>(Base64));
-static RegisterCommand r6(make_ref<CmdToBase>(SRI));
+static RegisterCommand r3("to-base16", [](){ return make_ref<CmdToBase>(Base16); });
+static RegisterCommand r4("to-base32", [](){ return make_ref<CmdToBase>(Base32); });
+static RegisterCommand r5("to-base64", [](){ return make_ref<CmdToBase>(Base64); });
+static RegisterCommand r6("to-sri", [](){ return make_ref<CmdToBase>(SRI); });
/* Legacy nix-hash command. */
static int compatNixHash(int argc, char * * argv)