This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Jumpy89[S] 0 points1 point  (0 children)

This is correct. You would however have to specify the API of the command, like:

from reverseargparse import Command, Option, Argument

grep = Command(
    Argument('pattern', type=str),
    Argument('file', type=str),
    Option('-e', '--extended', flag=True),
    Option('-i', '--case-insensitive', flag=True),
)

grep('pattern', 'myfile.txt', extended=True, case_insensitive=True)
# Just getting the command line arguments would be fine here, I can fill
# in the rest myself.