Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(doc): add commentary on default parser #715

Merged
merged 4 commits into from
Apr 25, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions universum/lib/module_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ def _needs_default_parser(subparsers_action, args):
return True

def _add_default_parser(self, args):
"""
We need to manually add the default parser because of the following reasons.
Argparser allows calls like this: ``./executable --arg=value1 subcommand --arg=value2``
after processing this is transformed to two different namespaces, each of which have
argument 'arg' with two different values. So calling ``universum -vt=p4 poll`` and
k-dovgan marked this conversation as resolved.
Show resolved Hide resolved
``universum poll -vt=p4``will transfer these args to different namespaces. Taking into
account that we also manually process environment variables, handling such structure
is more complicated, than excluding non-subcommand namespace complitely.
"""
subparsers_action = self._get_subparsers_action()
if not subparsers_action:
return
Expand Down