mirror of
https://github.com/NixOS/nix
synced 2025-06-27 04:21:16 +02:00
Support binary unit prefixes in command line arguments
This commit is contained in:
parent
6548b89cc4
commit
17beae299d
4 changed files with 29 additions and 27 deletions
|
@ -219,10 +219,8 @@ LegacyArgs::LegacyArgs(const std::string & programName,
|
|||
.description = description,
|
||||
.labels = {"n"},
|
||||
.handler = {[=](std::string s) {
|
||||
if (auto n = string2Int<unsigned int>(s))
|
||||
settings.set(dest, std::to_string(*n));
|
||||
else
|
||||
throw UsageError("'%s' is not an integer", s);
|
||||
auto n = string2IntWithUnitPrefix<uint64_t>(s);
|
||||
settings.set(dest, std::to_string(n));
|
||||
}}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue