After I've created my argument parser. How can I check if the parser contains a rule for an argument. Here's some code to explain what I mean.
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--foo')
parser.add_argument('--bar')
'foo' in parser
# => True
'bar' in parser
# => True
'baz' in parser
# => False
In short, I want to know if an argument exists in the parser.
As part of my program initialisation I am loading several configuration files. If there are settings in the config files which are not in the parser I want to warn the user.