I would, as a first try, get this working using an after-argparse function.
def addbar(args):
if args.bar is None:
args.bar = args.foo+'_BAR'
If this action needs to be reflected in the help
, put it there yourself.
In theory you could write a custom Action
for foo
that would set the value of the bar
value as well. But that requires more familiarity with the Action
class.
I tried a custom Action
that tweaks the default
of the bar
action, but that is tricky. parse_args
uses the defaults right at the start, before it has acted on any of the arguments.