

def parse_args(argv):
    'Build application argument parser and parse command line.\n    '
    try:
        root_defined = config['link_root_dir'].get()
    except confit.NotFoundError:
        root_defined = False
    config_by_fields = set(config.keys()).intersection(FIELDS)
    parser = argparse.ArgumentParser(description='Organize your movie collection using symbolic links', epilog='Example: flinck ~/Movies --by genre rating')
    parser.add_argument('media_src', metavar='FILE|DIR', help='media file or directory', type=to_unicode)
    config_by_fields.add_argument('-l', '--link_dir', help='links root directory', dest='link_root_dir', required=(not root_defined))
    parser.add_argument('--by', choices=FIELDS, nargs='+', metavar='FIELD1 FIELD2', default=config_by_fields, required=(not config_by_fields), help='organize medias by...\nPossible fields: {%(choices)s}')
    parser.add_argument('--version', action='version', version=('%(prog)s ' + __version__), help='display version information and exit')
    args = parser.parse_args(args=argv[1:])
    config.set_args(args)
    return vars(args)

dataset/ETHPy150Open Kraymer/flinck/flinck/__init__.py parse_args/VarMisuse@90/184 `parser`->`config_by_fields`