How would I be able to set up my argparser to have the following behaviour?
backup -c example
backup example
backup -r example
backup -l
backup --create example2
backup example2
backup --remove example2
backup --list
I would like to have my program have an assortment of flags to create/list/delete 'processes' not being outlined here. My intention that processes can be created with the --create
flag, which can then be called by using the name provided. The process could be deleted by passing the name to the --delete
flag. I would like to be able to have the non-flag argument (the name of the process that is to be run) passable without conflicting with the other flags which may or may not be store_true (in the case that the action is to list) or an argument (such as create/delete)
If I use a positional argument to capture the name of the backup process then I loose the ability to pass the flags in their intended manner the positional argument is required. However, without one I can't pass unspecified (arguments without a flag) arguments.
In this example you can imagine that -c
creates an artefact with the given name, calling that name outright triggers some computation to occur, and -r
removes the artefact with the given name.