I have created a pastebin terminal client in python. It can take some command line arguments, like -o
to open a file, -n
to set a paste name etc. It also has option -l
which lists the pastes and allows you to delete or view pastes. The problem is that I don't know how to do it in a nice way (using argparse) - it should not allow to use -l
with any other options.
I added a simple logic:
if args.name:
if args.list:
print('The -l should be used alone. Check "pb -h" for help.')
sys.exit()
Can it be done using just argparse? I know about mutually exclusive groups, I even have one (to set paste privacy) but I haven't figured this one yet.
Full code is available here: https://github.com/lkorba/pbstc/blob/master/pb
-l
with all the others)? - Eypros-l
or the others (there is one other limitation already implemented using mutually exclusive group:-p|-u
and this should stay as it is) - Lukasz Korbasiewicz