aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/args.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-01-08 12:51:19 +0100
committerEelco Dolstra <edolstra@gmail.com>2021-01-08 12:51:19 +0100
commit17beae299d5e6bb511c453d0b9d0d7ef906b3d14 (patch)
tree318c9a3745c9778dc47b92af67229d8fb2287805 /src/libutil/args.hh
parent6548b89cc4eb214cb4632fd4332c610f2d1f0a9d (diff)
Support binary unit prefixes in command line arguments
Diffstat (limited to 'src/libutil/args.hh')
-rw-r--r--src/libutil/args.hh5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/libutil/args.hh b/src/libutil/args.hh
index 823d843aa..3783bc84f 100644
--- a/src/libutil/args.hh
+++ b/src/libutil/args.hh
@@ -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)
{ }