List of all members.
Detailed Description
Definition at line 361 of file cmd2.py.
Constructor & Destructor Documentation
def cmd2::Cmd::__init__ |
( |
|
self, |
|
|
|
args, |
|
|
|
kwargs |
|
) |
| |
Member Function Documentation
def cmd2::Cmd::cmdloop |
( |
|
self | ) |
|
def cmd2::Cmd::colorize |
( |
|
self, |
|
|
|
val, |
|
|
|
color |
|
) |
| |
Given a string (``val``), returns that string wrapped in UNIX-style
special characters that turn on (and then off) text color and style.
If the ``colors`` environment paramter is ``False``, or the application
is running on Windows, will return ``val`` unchanged.
``color`` should be one of the supported strings (or styles):
red/blue/green/cyan/magenta, bold, underline
Definition at line 435 of file cmd2.py.
def cmd2::Cmd::complete_statement |
( |
|
self, |
|
|
|
line |
|
) |
| |
Keep accepting lines of input until the command is complete.
Definition at line 794 of file cmd2.py.
def cmd2::Cmd::do__relative_load |
( |
|
self, |
|
|
|
arg = None |
|
) |
| |
Runs commands in script at file or URL; if this is called from within an
already-running script, the filename will be interpreted relative to the
already-running script's directory.
Definition at line 1206 of file cmd2.py.
def cmd2::Cmd::do_cmdenvironment |
( |
|
self, |
|
|
|
args |
|
) |
| |
Summary report of interactive parameters.
Definition at line 446 of file cmd2.py.
def cmd2::Cmd::do_ed |
( |
|
self, |
|
|
|
arg |
|
) |
| |
ed: edit most recent command in text editor
ed [N]: edit numbered command from history
ed [filename]: edit specified file name
commands are run after editor is closed.
"set edit (program-name)" or set EDITOR environment variable
to control which editing program is used.
Definition at line 1128 of file cmd2.py.
def cmd2::Cmd::do_EOF |
( |
|
self, |
|
|
|
arg |
|
) |
| |
def cmd2::Cmd::do_help |
( |
|
self, |
|
|
|
arg |
|
) |
| |
def cmd2::Cmd::do_history |
( |
|
self, |
|
|
|
arg, |
|
|
|
opts |
|
) |
| |
history [arg]: lists past commands issued
| no arg: list all
| arg is integer: list one history item, by index
| arg is string: string search
| arg is /enclosed in forward-slashes/: regular expression search
Definition at line 1083 of file cmd2.py.
def cmd2::Cmd::do_list |
( |
|
self, |
|
|
|
arg |
|
) |
| |
list [arg]: lists last command issued
no arg -> list most recent command
arg is integer -> list one history item, by index
a..b, a:b, a:, ..b -> list spans from a (or start) to b (or end)
arg is string -> list all commands matching string search
arg is /enclosed in forward-slashes/ -> regular expression search
Definition at line 1108 of file cmd2.py.
def cmd2::Cmd::do_load |
( |
|
self, |
|
|
|
arg = None |
|
) |
| |
Runs script of command(s) from a file or URL.
Definition at line 1218 of file cmd2.py.
def cmd2::Cmd::do_pause |
( |
|
self, |
|
|
|
arg |
|
) |
| |
def cmd2::Cmd::do_py |
( |
|
self, |
|
|
|
arg |
|
) |
| |
py <command>: Executes a Python command.
py: Enters interactive Python mode.
End with ``Ctrl-D`` (Unix) / ``Ctrl-Z`` (Windows), ``quit()``, '`exit()``.
Non-python commands can be issued with ``cmd("your command")``.
Run python code from external files with ``run("filename.py")``
Definition at line 1039 of file cmd2.py.
def cmd2::Cmd::do_quit |
( |
|
self, |
|
|
|
arg |
|
) |
| |
def cmd2::Cmd::do_run |
( |
|
self, |
|
|
|
arg |
|
) |
| |
run [arg]: re-runs an earlier command
no arg -> run most recent command
arg is integer -> run one history item, by index
arg is string -> run most recent command by string search
arg is /enclosed in forward-slashes/ -> run most recent by regex
Definition at line 1243 of file cmd2.py.
def cmd2::Cmd::do_save |
( |
|
self, |
|
|
|
arg |
|
) |
| |
`save [N] [filename.ext]`
Saves command from history to file.
| N => Number of command (from history), or `*`;
| most recent command if omitted
Definition at line 1160 of file cmd2.py.
def cmd2::Cmd::do_set |
( |
|
self, |
|
|
|
arg |
|
) |
| |
Sets a cmd2 parameter. Accepts abbreviated parameter names so long
as there is no ambiguity. Call without arguments for a list of
settable parameters with their values.
Definition at line 1000 of file cmd2.py.
def cmd2::Cmd::do_shell |
( |
|
self, |
|
|
|
arg |
|
) |
| |
def cmd2::Cmd::do_shortcuts |
( |
|
self, |
|
|
|
args |
|
) |
| |
Lists single-key shortcuts available.
Definition at line 479 of file cmd2.py.
def cmd2::Cmd::do_show |
( |
|
self, |
|
|
|
arg, |
|
|
|
opts |
|
) |
| |
Shows value of a parameter.
Definition at line 982 of file cmd2.py.
def cmd2::Cmd::fileimport |
( |
|
self, |
|
|
|
statement, |
|
|
|
source |
|
) |
| |
def cmd2::Cmd::func_named |
( |
|
self, |
|
|
|
arg |
|
) |
| |
def cmd2::Cmd::last_matching |
( |
|
self, |
|
|
|
arg |
|
) |
| |
def cmd2::Cmd::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.
This (`cmd2`) version of `onecmd` already override's `cmd`'s `onecmd`.
Definition at line 844 of file cmd2.py.
def cmd2::Cmd::onecmd_plus_hooks |
( |
|
self, |
|
|
|
line |
|
) |
| |
def cmd2::Cmd::parsed |
( |
|
self, |
|
|
|
raw, |
|
|
|
kwargs |
|
) |
| |
def cmd2::Cmd::perror |
( |
|
self, |
|
|
|
errmsg, |
|
|
|
statement = None |
|
) |
| |
def cmd2::Cmd::pfeedback |
( |
|
self, |
|
|
|
msg |
|
) |
| |
For printing nonessential feedback. Can be silenced with `quiet`.
Inclusion in redirected output is controlled by `feedback_to_output`.
Definition at line 408 of file cmd2.py.
def cmd2::Cmd::postparse |
( |
|
self, |
|
|
|
parseResult |
|
) |
| |
def cmd2::Cmd::postparsing_postcmd |
( |
|
self, |
|
|
|
stop |
|
) |
| |
def cmd2::Cmd::postparsing_precmd |
( |
|
self, |
|
|
|
statement |
|
) |
| |
def cmd2::Cmd::poutput |
( |
|
self, |
|
|
|
msg |
|
) |
| |
Convenient shortcut for self.stdout.write(); adds newline if necessary.
Definition at line 398 of file cmd2.py.
def cmd2::Cmd::preparse |
( |
|
self, |
|
|
|
raw, |
|
|
|
kwargs |
|
) |
| |
def cmd2::Cmd::pseudo_raw_input |
( |
|
self, |
|
|
|
prompt |
|
) |
| |
copied from cmd's cmdloop; like raw_input, but accounts for changed stdin, stdout
Definition at line 876 of file cmd2.py.
def cmd2::Cmd::read_file_or_url |
( |
|
self, |
|
|
|
fname |
|
) |
| |
def cmd2::Cmd::redirect_output |
( |
|
self, |
|
|
|
statement |
|
) |
| |
def cmd2::Cmd::restore_output |
( |
|
self, |
|
|
|
statement |
|
) |
| |
def cmd2::Cmd::run_commands_at_invocation |
( |
|
self, |
|
|
|
callargs |
|
) |
| |
def cmd2::Cmd::runTranscriptTests |
( |
|
self, |
|
|
|
callargs |
|
) |
| |
def cmd2::Cmd::select |
( |
|
self, |
|
|
|
options, |
|
|
|
prompt = 'Your choice? ' |
|
) |
| |
Presents a numbered menu to the user. Modelled after
the bash shell's SELECT. Returns the item chosen.
Argument ``options`` can be:
| a single string -> will be split into one-word options
| a list of strings -> will be offered as options
| a list of tuples -> interpreted as (value, text), so
that the return value can differ from
the text advertised to the user
Definition at line 946 of file cmd2.py.
Member Data Documentation
Initial value:{'bold':{True:'\x1b[1m',False:'\x1b[22m'},
'cyan':{True:'\x1b[36m',False:'\x1b[39m'},
'blue':{True:'\x1b[34m',False:'\x1b[39m'},
'red':{True:'\x1b[31m',False:'\x1b[39m'},
'magenta':{True:'\x1b[35m',False:'\x1b[39m'},
'green':{True:'\x1b[32m',False:'\x1b[39m'},
'underline':{True:'\x1b[4m',False:'\x1b[24m'}}
Definition at line 427 of file cmd2.py.
Initial value:(pyparsing.Optional(pyparsing.Word(pyparsing.nums)^'*')("idx") +
pyparsing.Optional(pyparsing.Word(legalChars + '/\\'))("fname") +
pyparsing.stringEnd)
Definition at line 1157 of file cmd2.py.
Initial value:stubbornDict('''
prompt
colors Colorized output (*nix only)
continuation_prompt On 2nd+ line of input
debug Show full error stack on error
default_file_name for ``save``, ``load``, etc.
editor Program used by ``edit``
case_insensitive upper- and lower-case both OK
feedback_to_output include nonessentials in `|`, `>` results
quiet Don't print nonessential feedback
echo Echo command issued into output
timing Report execution times
abbrev Accept abbreviated commands
''')
Reimplemented in pirate7::Pirate, and pirate8::Pirate.
Definition at line 383 of file cmd2.py.
The documentation for this class was generated from the following file:
- /Users/amrogers/Developer/Projects/cmd2/cmd2.py