Python: module CustomShell

CustomShell | index customshell.py

`This script implement a Custom Shell.`

Modules
`` |  |
os | ntpath | platform | sys

Classes
`` |  | cmd.Cmd(builtins.object) Shell
class Shell(cmd.Cmd)
`` | `This class implement the custom shell.`
| Method resolution order: Shell cmd.Cmd builtins.object Methods defined here: __init__(self) `Instantiate a line-oriented interpreter framework. The optional argument 'completekey' is the readline name of a completion key; it defaults to the Tab key. If completekey is not None and the readline module is available, command completion is done automatically. The optional arguments stdin and stdout specify alternate input and output file objects; if not specified, sys.stdin and sys.stdout are used.` check_config_file(self) -> bool `Check the config file and write it (with default config) if not exist.` default(self, arg: str) -> None `Execute command line.` do_cd(self, arg: str) -> None `Command cd to change the current directory.` do_exit(self, arg: str) -> None `Command exit, quit and close the shell with error code 0.` format(self, string: str) -> str `This fonction format string template.` get_config(self, section: str, value: str) -> ~Config `This function return config or None` postcmd(self, stop: bool, arg: str) -> bool `This function re-write the prompt value.` postloop(self) -> None `This function print quit and change the Unix Shell Color.` precmd(self, arg: str) -> str `This function change ALIAS into real command.` preloop(self) -> None `This function print intro and change the Unix Shell Color.` Methods inherited from cmd.Cmd: cmdloop(self, intro=None) `Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.` columnize(self, list, displaywidth=80) `Display a list of strings as a compact set of columns. Each column is only as wide as necessary. Columns are separated by two spaces (one was not legible enough).` complete(self, text, state) `Return the next possible completion for 'text'. If a command has not been entered, then complete against command list. Otherwise try to call complete_<command> to get list of completions.` complete_help(self, *args) completedefault(self, *ignored) `Method called to complete an input line when no command-specific complete_*() method is available. By default, it returns an empty list.` completenames(self, text, *ignored) do_help(self, arg) `List available commands with "help" or detailed help with "help cmd".` emptyline(self) `Called when an empty line is entered in response to the prompt. If this method is not overridden, it repeats the last nonempty command entered.` get_names(self) onecmd(self, line) `Interpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter should stop.` parseline(self, line) `Parse the line into a command name and a string containing the arguments. Returns a tuple containing (command, args, line). 'command' and 'args' may be None if the line couldn't be parsed.` print_topics(self, header, cmds, cmdlen, maxcol) Data descriptors inherited from cmd.Cmd: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes inherited from cmd.Cmd: doc_header = 'Documented commands (type help <topic>):' doc_leader = '' identchars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' intro = None lastcmd = '' misc_header = 'Miscellaneous help topics:' nohelp = '*** No help on %s' prompt = '(Cmd) ' ruler = '=' undoc_header = 'Undocumented commands:' use_rawinput = 1

Functions
`` |  | main()

Data
`` |  | CONFIG_VAR = {'{N}': <built-in function gethostname>, '{P}': <built-in function getcwd>, '{T}': <function <lambda>>, '{U}': <function getuser>, '{n}': <function <lambda>>, '{p}': <function system>, '{s}': <function <lambda>>} __all__ = ['Shell', 'CONFIG_VAR', 'main']