parmed.tools.parmed_cmd module¶
This sets up the command interpreter for textual ParmEd (parmed).
-
class
parmed.tools.parmed_cmd.
ParmedCmd
(parm, stdin=None, stdout=None)[source]¶ Bases:
cmd.Cmd
ParmEd command interpreter. The docstrings for each do_* command are simply copied from the docstring for that Action’s docstring
- Attributes
- intro
Methods
cmdloop
([intro])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
(list[, displaywidth])Display a list of strings as a compact set of columns.
complete
(text, state)Return the next possible completion for ‘text’.
completedefault
(text, line, begidx, endidx)Method called to complete an input line when no command-specific complete_*() method is available.
default
(line)Called on an input line when the command prefix is not recognized.
do_EOF
(line)Stops reading commands and executes any ‘parmout’ command that had been issued
do_go
(line)Stops reading commands and executes any ‘parmout’ command that had been issued
do_help
(arg)Modify the original do_help to pull docstrings from actions
do_history
(line)Print the command history
do_quit
(line)Stops reading commands and quits WITHOUT running the last ‘parmout’ command that had been issued
do_shell
(line)Support the limited interpreter
Override emptyline so that empty lines are simply ignored
onecmd
(line)Interpret the argument as though it had been typed in response to the prompt.
parseline
(line)Override parseline so that it will set args as ArgumentList
This will create all of the do_Command methods to trigger command auto-complete.
postcmd
(stop, line)Hook method executed just after a command dispatch is finished.
postloop
()Hook method executed once when the cmdloop() method is about to return.
preloop
()Hook method executed once when the cmdloop() method is called.
setlog
(f)Open up a log file to start logging the commands.
complete_help
completenames
do_parmout
do_source
get_names
precmd
print_topics
-
completedefault
(text, line, begidx, endidx)[source]¶ Method called to complete an input line when no command-specific complete_*() method is available.
By default, it returns an empty list.
-
default
(line)[source]¶ Called on an input line when the command prefix is not recognized.
If this method is not overridden, it prints an error message and returns.
-
do_EOF
(line)¶ Stops reading commands and executes any ‘parmout’ command that had been issued
-
do_quit
(line)[source]¶ Stops reading commands and quits WITHOUT running the last ‘parmout’ command that had been issued
-
classmethod
populate_actions
()[source]¶ This will create all of the do_Command methods to trigger command auto-complete. This eliminates the need to modify the ParmedCmd class when a new command is added
-
precmd
(line, *args, **kwargs)[source]¶ Hook method executed just before the command line is interpreted, but after the input prompt is generated and issued.
-
prompt
= '> '¶
-
class
parmed.tools.parmed_cmd.
PythonCmd
(stdin=None, stdout=None)[source]¶ Bases:
cmd.Cmd
Command interpreter for limited Python interpreter
- Attributes
- intro
Methods
cmdloop
([intro])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
(list[, displaywidth])Display a list of strings as a compact set of columns.
complete
(text, state)Return the next possible completion for ‘text’.
completedefault
(*ignored)Method called to complete an input line when no command-specific complete_*() method is available.
default
(line)Add this onto the command string
do_EOF
(line)Break out of the shell
do_help
(arg)List available commands with “help” or detailed help with “help cmd”.
do_shell
(line)Break out of the shell
Ignore all empty lines
onecmd
(line)Interpret the argument as though it had been typed in response to the prompt.
parseline
(line)Override parseline
postcmd
(stop, line)Hook method executed just after a command dispatch is finished.
postloop
()Hook method executed once when the cmdloop() method is about to return.
preloop
()Hook method executed once when the cmdloop() method is called.
setlog
(f)Open up a log file to start logging the commands
complete_help
completenames
get_names
precmd
print_topics
-
precmd
(line, *args, **kwargs)¶ Hook method executed just before the command line is interpreted, but after the input prompt is generated and issued.
-
prompt
= 'py >>> '¶