Skip to content

Commit

Permalink
Add logic for module handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolphpienaar committed Apr 29, 2024
1 parent 5fea5b8 commit 84b455a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion spleenseg/splparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,21 @@ def parser_setup(str_desc):
return parser


def parser_interpret(parser, *args):
def parser_interpret(parser, *args, **kwargs):
"""
Interpret the list space of *args, or sys.argv[1:] if
*args is empty
"""
asModule: bool = False
for k, v in kwargs.items():
if k == "asModule":
asModule = v
if asModule:
# Here, spleenseg is used a module to another app
# and the CLI sys.argv is that of the parent app
# not spleenseg. Interpret the passwd parser and
# return.
return parser.parse_args()
if len(args):
args = parser.parse_args(*args)
else:
Expand Down

0 comments on commit 84b455a

Please sign in to comment.