def check_for_file(command_str, options): path = access.interpret_path(command_str) if globbing.is_glob_command(path) or access.is_valid_path(path): assert options == [] # are we ever going to have options for a file? options = [path] return create_command('file', options)
def execute(input, options, environment): files = [] if (input != None and len(input) > 0): # check input is all files? files = input assert len(options) == 1 path = access.interpret_path(options[0]) if globbing.is_glob_command(path): paths = expand_globs(path) else: paths = [path] for path in paths: files.append(recognise_file.create_file(path)) return files