'Command line argument processing'

def read_cli_args(self):

    parser = argparse.ArgumentParser(description='Produce    an    Ansible    Inventory    file    based    nodes    in    a    Consul    cluster')
    parser.add_argument('--list', action='store_true', help='Get    all    inventory    variables    from    all    nodes    in    the    consul    cluster')
    parser.add_argument('--host', action='store', help='Get    all    inventory    variables    about    a    specific    consul    node,requires    datacenter    set    in    consul.ini.')
    parser.add_argument('--datacenter', action='store', help='Get    all    inventory    about    a    specific    consul    datacenter')
    args = parser.parse_args()
    arg_names = ['host', 'datacenter']
    for arg in arg_names:
        if getattr(args, arg):
            setattr(self, arg, getattr(args, arg))
