1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 06:01:48 +02:00

nix hash convert: s/--type/--algo/ + more functional tests

https://github.com/NixOS/nix/issues/8876
This commit is contained in:
Peter Kolloch 2023-11-28 11:42:52 +01:00
parent 6bbd900d4f
commit 0c2d5f7673
3 changed files with 71 additions and 10 deletions

View file

@ -40,7 +40,6 @@ enum struct HashFormat : int {
SRI
};
struct Hash
{
constexpr static size_t maxHashSize = 64;

View file

@ -162,9 +162,9 @@ struct CmdHashConvert : Command
}},
});
addFlag({
.longName = "type",
.description = "Specify the type if it can't be auto-detected.",
.labels = {"hash type"},
.longName = "algo",
.description = "Specify the algorithm if it can't be auto-detected.",
.labels = {"hash algorithm"},
.handler = {[this](std::string str) {
type = parseHashType(str);
}},
@ -177,7 +177,7 @@ struct CmdHashConvert : Command
std::string description() override
{
return "convert between different hash formats, e.g. base16 and sri.";
return "convert between different hash formats, e.g. base16, nix32, base64 and sri.";
}
Category category() override { return catUtility; }