File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -163,8 +163,11 @@ struct CmdToBase : Command
163163 HashFormat hashFormat;
164164 std::optional<HashAlgorithm> hashAlgo;
165165 std::vector<std::string> args;
166+ bool legacyCli;
166167
167- CmdToBase (HashFormat hashFormat) : hashFormat(hashFormat)
168+ CmdToBase (HashFormat hashFormat, bool legacyCli = false )
169+ : hashFormat(hashFormat)
170+ , legacyCli(legacyCli)
168171 {
169172 addFlag (flag::hashAlgoOpt (" type" , &hashAlgo));
170173 expectArgs (" strings" , &args);
@@ -181,7 +184,8 @@ struct CmdToBase : Command
181184
182185 void run () override
183186 {
184- warn (" The old format conversion sub commands of `nix hash` were deprecated in favor of `nix hash convert`." );
187+ if (!legacyCli)
188+ warn (" The old format conversion subcommands of `nix hash` were deprecated in favor of `nix hash convert`." );
185189 for (const auto & s : args)
186190 logger->cout (Hash::parseAny (s, hashAlgo).to_string (hashFormat, hashFormat == HashFormat::SRI));
187191 }
@@ -328,7 +332,7 @@ static int compatNixHash(int argc, char * * argv)
328332 }
329333
330334 else {
331- CmdToBase cmd (hashFormat);
335+ CmdToBase cmd (hashFormat, true );
332336 cmd.args = ss;
333337 if (hashAlgo.has_value ()) cmd.hashAlgo = hashAlgo;
334338 cmd.run ();
You can’t perform that action at this time.
0 commit comments