From bd77d891159eefa6089887c1466873dd9afefa6a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Piotr=20Husiaty=C5=84ski?= Date: Mon, 11 Feb 2008 15:06:53 +0100 Subject: [PATCH] Changing aur-shell.py name to pyshell.py --- aur-shell.py => pyshell.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) rename aur-shell.py => pyshell.py (99%) diff --git a/aur-shell.py b/pyshell.py similarity index 99% rename from aur-shell.py rename to pyshell.py index 0ec69f1..ba87ac6 100644 --- a/aur-shell.py +++ b/pyshell.py @@ -1,7 +1,8 @@ #!/usr/bin/python # -*- coding: utf-8-*- -"""Aur Shell is simple shell framework. +""" +Aur Shell is simple shell framework. To use it, write some plugins that Aur Shell would use. """ @@ -40,6 +41,7 @@ class AurShell(cmd.Cmd): readline.read_history_file(conf.history_file) readline.set_history_length(conf.history_length) + def default(self, cmd=None): """Run commands. @@ -88,6 +90,7 @@ class AurShell(cmd.Cmd): # object is not callable self.put("%s : bad usage" % cmd[0]) + def completenames(self, text, *ignored): """Complete commands""" dotext = 'do_'+text @@ -97,6 +100,7 @@ class AurShell(cmd.Cmd): module_cmd_list = [a + " " for a in self.commands.keys() if a.startswith(text)] return local_cmd_list + module_cmd_list + def completedefault(self, text, line, begidx, endidx): """Complete commands argument""" line = line.split() @@ -113,6 +117,7 @@ class AurShell(cmd.Cmd): else: return [] + def do_help(self, arg): """Show help for commands""" arg = arg.split() @@ -131,11 +136,13 @@ class AurShell(cmd.Cmd): except KeyError: self.put("No help found.") + def do_clear(self, *ignored): """Clear the screen""" # TODO 2008-02-09 20:44:50 self.put("Todo, sorry") + def do_history(self, hnumb=None, *ignored): """Show the history""" # TODO better history listing @@ -173,6 +180,7 @@ Usage: history history 22- -> from 22 fo the end of history file history -22 -> same as 22-""") + def do_quit(self, *ignored): """Quit from shell""" if conf.history_length: @@ -184,6 +192,8 @@ Usage: history do_EOF = do_quit do_exit = do_quit + + if __name__ == "__main__": shell = AurShell() try: -- 2.11.4.GIT