def click ( self ): """ Handles the user left-clicking on the tag. """ shell = self.shell shell.append_items( shell.history_item_for( file_class_for( self.file ), self.file, line = self.line, parent = self.shell_item.parent ) )
def execute(self): """ Displays files in the current working directory, or elsewhere if an explicit path is provided in the command's options. """ search = self.options files = [] directories = [] search_path = abspath(join(self.shell.cwd, search)) if isdir(search_path): if self.command == "l": search_path = join(search_path, "*.py") else: search_path = join(search_path, "*") base_path = dirname(search_path) for name in glob(search_path): if isdir(join(base_path, name)): directories.append(name) else: files.append(name) hif = self.shell.history_item_for return [hif(DirectoryItem, name) for name in directories] + [hif(file_class_for(name), name) for name in files]