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
- Renamed the `bypass_required` argument attribute to `suppress_arg_checks`
- Introduced the `suppress_group_checks` argument attribute
- Aligned the tutorial page and documentation comments
- Made code cleanup changes
Copy file name to clipboardExpand all lines: README.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ Command-line argument parser for C++20
34
34
35
35
> [!NOTE]
36
36
>
37
-
> [v1.0](https://github.com/SpectraL519/cpp-ap/commit/9a9e5360766b732f322ae2efe3cf5ec5f9268eef) of the library has been developed for the *Team Programming* course at the *Wrocław University of Science and Technology*.
37
+
> [v1.0](https://github.com/SpectraL519/cpp-ap/releases/tag/v1.0) of the library has been developed for the *Team Programming* course at the *Wrocław University of Science and Technology*.
38
38
>
39
39
> Faculty: *W04N - Faculty of Information and Communication Technology*
40
40
>
@@ -62,6 +62,11 @@ Command-line argument parser for C++20
62
62
-[Parameters Specific for Optional Arguments](/docs/tutorial.md#parameters-specific-for-optional-arguments)
-[help](#1-help---the-arguments-description-which-will-be-printed-when-printing-the-parser-class-instance) - the text shown in the help message to describe an argument
16
+
-[hidden](#2-hidden---if-this-option-is-set-for-an-argument-then-it-will-not-be-included-in-the-program-description) - hides the argument from the generated program description and help output
17
+
-[required](#3-required---if-this-option-is-set-for-an-argument-and-its-value-is-not-passed-in-the-command-line-an-exception-will-be-thrown) - marks the argument as mandatory; not using it will cause an error
18
+
-[suppress arg checks](#4-suppress_arg_checks---using-a-suppressing-argument-results-in-suppressing-requirement-checks-for-other-arguments) - if a suppressing argument is used, other requirement validation will be skipped for other arguments
19
+
-[nargs](#5-nargs---sets-the-allowed-number-of-values-to-be-parsed-for-an-argument) - defines how many values an argument can or must accept
20
+
-[greedy](#6-greedy---if-this-option-is-set-the-argument-will-consume-all-command-line-values-until-its-upper-nargs-bound-is-reached) - makes the argument consume all following values until its limit is reached
21
+
-[choices](#7-choices---a-list-of-valid-argument-values) - restricts the valid inputs to a predefined set of values
22
+
-[value actions](#8-value-actions---functions-that-are-called-after-parsing-an-arguments-value) - allows you to run custom code after the argument’s value is parsed
23
+
-[default values](#9-default_values---a-list-of-values-which-will-be-used-if-no-values-for-an-argument-have-been-parsed) - specifies fallback values to use if none are provided
24
24
-[Parameters Specific for Optional Arguments](#parameters-specific-for-optional-arguments)
-[on-flag actions](#1-on-flag-actions---functions-that-are-called-immediately-after-parsing-an-arguments-flag) - executes custom code immediately when the argument’s flag is present
26
+
-[implicit values](#2-implicit_values---a-list-of-values-which-will-be-set-for-an-argument-if-only-its-flag-but-no-values-are-parsed-from-the-command-line) - automatically assigns a value if an argument flag is used without an explicit value
> - The default value type of any argument is `std::string`.
224
225
> - If the argument's value type is `ap::none_type`, the argument will not accept any values and therefore no value-related parameters can be set for such argument. This includes:
> - If a positional argument is defined as non-required, then no required positional argument can be defined after (only other non-required positional arguments and optional arguments will be allowed).
321
-
> - For both positional and optional arguments:
322
-
> - enabling the `required` option disables the `bypass_required` option
323
-
> - disabling the `required` option has no effect on the `bypass_required` option.
322
+
> - If an argument is suppressing (see [suppress arg checks](#4-suppress_arg_checks---using-a-suppressing-argument-results-in-suppressing-requirement-checks-for-other-arguments) and [Suppressing Argument Group Checks](#suppressing-argument-group-checks)), then it cannot be required (an exception will be thrown).
324
323
325
324
```cpp
326
325
// example: positional arguments
@@ -377,24 +376,27 @@ Command Result
377
376
378
377
<br />
379
378
380
-
#### 4. `bypass_required` - If this option is set for an argument, the `required` option for other arguments will be discarded if the bypassing argument is used in the command-line.
379
+
#### 4. `suppress_arg_checks` - Using a suppressing argument results in suppressing requirement checks for other arguments.
380
+
381
+
If an argument is defined with the `suppress_arg_checks` option enabled and such argument is explicitly used in the command-line, then requirement validation will be suppressed/skipped for other arguments. This includes validating whether:
382
+
- a required argument has been parsed
383
+
- the number of values parsed for an argument matches the specified [nargs](#5-nargs---sets-the-allowed-number-of-values-to-be-parsed-for-an-argument) range.
381
384
382
385
> [!NOTE]
383
386
>
384
-
> -Both all arguments have the `bypass_required` option disabled.
385
-
> - The default value of the value parameter of the `argument::bypass_required(bool)` method is `true` for all arguments.
387
+
> -All arguments have the `suppress_arg_checks` option disabled by default.
388
+
> - The default value of the value parameter of the `argument::suppress_arg_checks(bool)` method is `true` for all arguments.
386
389
387
390
> [!WARNING]
388
391
>
389
-
> For both positional and optional arguments:
390
-
> - enabling the `bypass_required` option disables the `required` option
391
-
> - disabling the `bypass_required` option has no effect on the `required` option.
392
+
> - Enabling the `suppress_arg_checks` option has no effect on [argument group](#argument-groups) requirements validation.
393
+
> - Enabling argument checks suppressing is not possible for required arguments (an exception will be thrown).
Similarly to [suppressing argument checks](#4-suppress_arg_checks---using-a-suppressing-argument-results-in-suppressing-requirement-checks-for-other-arguments), an argument can suppress the requirement checks of argument groups:
942
+
943
+
```c++
944
+
argument.suppress_group_checks();
945
+
```
946
+
947
+
If such argument is used the requirement checks associated with the [group attributes](#group-attributes) will not be validated.
948
+
949
+
> [!NOTE]
950
+
>
951
+
> - All arguments have the `suppress_group_checks` option disabled by default.
952
+
> - The default value of the value parameter of the `argument::suppress_group_checks(bool)` method is `true` for all arguments.
953
+
954
+
> [!WARNING]
955
+
>
956
+
> - Enabling the `suppress_group_checks` option has no effect on argument requirements validation.
957
+
> - Enabling argument group checks suppressing is not possible for required arguments (an exception will be thrown).
0 commit comments