1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 02:11:15 +02:00

Support binary unit prefixes in command line arguments

This commit is contained in:
Eelco Dolstra 2021-01-08 12:51:19 +01:00
parent 6548b89cc4
commit 17beae299d
4 changed files with 29 additions and 27 deletions

View file

@ -87,10 +87,7 @@ protected:
template<class I>
Handler(I * dest)
: fun([=](std::vector<std::string> ss) {
if (auto n = string2Int<I>(ss[0]))
*dest = *n;
else
throw UsageError("'%s' is not an integer", ss[0]);
*dest = string2IntWithUnitPrefix<I>(ss[0]);
})
, arity(1)
{ }