def interpret_sys_argv(): """Interpret the args from a command line""" options, not_options = divide(strip_puv_options(sys.argv[1:]), is_option) options = separate_options(options) args = de_duplicate([tab_complete(a, expand) for a in not_options]) paths = script_paths.arg_paths(args) or [ paths.pyc_to_py(a) for a in tab_complete(args, expand) ] return paths, options
def arg_paths(sys_args): arg_files = paths.files(sift(sys_args)) if arg_files: return arg_files return [ paths.pyc_to_py(a) for a in paths.tab_complete(sys_args, paths.add_stars) ]
def vim_tab_complete(string): if is_option(string): return string if not missing_extension(string): return string return tab_complete(string)