Skip to content

Commit 2771a8e

Browse files
committed
Make positional arguments implicitly required
When computing the help text for required or defaults, include positional arguments in those that are required.
1 parent 485f0b9 commit 2771a8e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tap/tap.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
get_origin,
2222
GitInfo,
2323
is_option_arg,
24+
is_positional_arg,
2425
type_to_str,
2526
get_literals,
2627
boolean_type,
@@ -159,7 +160,7 @@ def _add_argument(self, *name_or_flags, **kwargs) -> None:
159160
kwargs['help'] += type_to_str(self._annotations[variable]) + ', '
160161

161162
# Required/default
162-
if kwargs.get('required', False):
163+
if kwargs.get('required', False) or is_positional_arg(*name_or_flags):
163164
kwargs['help'] += 'required'
164165
else:
165166
kwargs['help'] += f'default={kwargs.get("default", None)}'

0 commit comments

Comments
 (0)