mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Merge pull request #9822 from obsidiansystems/algo-vs-hash-algo
Start standardizing hash algo flags
This commit is contained in:
commit
c8d33bca8d
5 changed files with 30 additions and 24 deletions
|
@ -177,7 +177,13 @@ protected:
|
|||
std::optional<ExperimentalFeature> experimentalFeature;
|
||||
|
||||
static Flag mkHashAlgoFlag(std::string && longName, HashAlgorithm * ha);
|
||||
static Flag mkHashAlgoFlag(HashAlgorithm * ha) {
|
||||
return mkHashAlgoFlag("hash-algo", ha);
|
||||
}
|
||||
static Flag mkHashAlgoOptFlag(std::string && longName, std::optional<HashAlgorithm> * oha);
|
||||
static Flag mkHashAlgoOptFlag(std::optional<HashAlgorithm> * oha) {
|
||||
return mkHashAlgoOptFlag("hash-algo", oha);
|
||||
}
|
||||
static Flag mkHashFormatFlagWithDefault(std::string && longName, HashFormat * hf);
|
||||
static Flag mkHashFormatOptFlag(std::string && longName, std::optional<HashFormat> * ohf);
|
||||
};
|
||||
|
|
|
@ -53,7 +53,7 @@ struct CmdAddToStore : MixDryRun, StoreCommand
|
|||
}},
|
||||
});
|
||||
|
||||
addFlag(Flag::mkHashAlgoFlag("hash-algo", &hashAlgo));
|
||||
addFlag(Flag::mkHashAlgoFlag(&hashAlgo));
|
||||
}
|
||||
|
||||
void run(ref<Store> store) override
|
||||
|
|
|
@ -141,7 +141,7 @@ struct CmdHashConvert : Command
|
|||
CmdHashConvert(): to(HashFormat::SRI) {
|
||||
addFlag(Args::Flag::mkHashFormatOptFlag("from", &from));
|
||||
addFlag(Args::Flag::mkHashFormatFlagWithDefault("to", &to));
|
||||
addFlag(Args::Flag::mkHashAlgoOptFlag("algo", &algo));
|
||||
addFlag(Args::Flag::mkHashAlgoOptFlag(&algo));
|
||||
expectArgs({
|
||||
.label = "hashes",
|
||||
.handler = {&hashStrings},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue