You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support for size values (640 KB) and numbers with unit in general (#253)
* [WIP] Initial implementation
* Add mapping validation
* More documentation
* Add support for floats in checked_multiply and add tests
* Place SuffixedNumber declaration correctly
* Add tests
* Refactor SuffixedNumber
* Add as size value
* Update README
* SFINAE for checked_multiply()
* Mark ctors as explicit
* Small fixes
* Clang format
* Clang format
* Adding GCC 4.7 support
* Rename SuffixedNumber to AsNumberWithUnit
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -243,7 +243,7 @@ The `add_option_function<type>(...` function will typically require the template
243
243
🚧 Flag options specified through the `add_flag*` functions allow a syntax for the option names to default particular options to a false value or any other value if some flags are passed. For example:
244
244
245
245
```cpp
246
-
app.add_flag("--flag,!--no-flag,result,"help for flag"); // 🚧
246
+
app.add_flag("--flag,!--no-flag",result,"help for flag"); // 🚧
247
247
```
248
248
249
249
specifies that if `--flag` is passed on the command line result will be true or contain a value of 1. If `--no-flag` is
@@ -341,6 +341,8 @@ CLI11 has several Validators built-in that perform some common checks
341
341
-`CLI::IsMember(...)`: 🚧 Require an option be a member of a given set. See [Transforming Validators](#transforming-validators) for more details.
342
342
-`CLI::Transformer(...)`: 🚧 Modify the input using a map. See [Transforming Validators](#transforming-validators) for more details.
343
343
-`CLI::CheckedTransformer(...)`: 🚧 Modify the input using a map, and require that the input is either in the set or already one of the outputs of the set. See [Transforming Validators](#transforming-validators) for more details.
344
+
-`CLI::AsNumberWithUnit(...)`: Modify the `<NUMBER> <UNIT>` pair by matching the unit and multiplying the number by the corresponding factor. It can be used as a base for transformers, that accept things like size values (`1 KB`) or durations (`0.33 ms`).
345
+
-`CLI::AsSizeValue(...)`: Convert inputs like `100b`, `42 KB`, `101 Mb`, `11 Mib` to absolute values. `KB` can be configured to be interpreted as 10^3 or 2^10.
344
346
-`CLI::ExistingFile`: Requires that the file exists if given.
345
347
-`CLI::ExistingDirectory`: Requires that the directory exists.
346
348
-`CLI::ExistingPath`: Requires that the path (file or directory) exists.
0 commit comments