• Home
  • Raw
  • Download

Lines Matching +full:command +full:- +full:line

1 :mod:`cmd` --- Support for line-oriented command interpreters
5 :synopsis: Build line-oriented command interpreters.
10 --------------
12 The :class:`Cmd` class provides a simple framework for writing line-oriented
13 command interpreters. These are often useful for test harnesses, administrative
19 A :class:`Cmd` instance or subclass instance is a line-oriented interpreter
26 :mod:`readline` is available, command completion is done automatically.
41 .. _cmd-objects:
44 -----------
53 the line as argument.
59 :program:`bash`\ -like history-list editing (e.g. :kbd:`Control-P` scrolls back
60 to the last command, :kbd:`Control-N` forward to the next one, :kbd:`Control-F`
61 moves the cursor to the right non-destructively, :kbd:`Control-B` moves the
62 cursor to the left non-destructively, etc.).
64 An end-of-file on input is passed back as the string ``'EOF'``.
66 An interpreter instance will recognize a command name ``foo`` if and only if it
67 has a method :meth:`do_foo`. As a special case, a line beginning with the
69 special case, a line beginning with the character ``'!'`` is dispatched to the
73 The *stop* argument to :meth:`postcmd` is the return value from the command's
78 arguments *text*, *line*, *begidx*, and *endidx*. *text* is the string prefix
79 we are attempting to match: all returned matches must begin with it. *line* is
80 the current input line with leading whitespace removed, *begidx* and *endidx*
99 interpreter should stop. If there is a :meth:`do_\*` method for the command
106 Method called when an empty line is entered in response to the prompt. If this
107 method is not overridden, it repeats the last nonempty command entered.
110 .. method:: Cmd.default(line)
112 Method called on an input line when the command prefix is not recognized. If
116 .. method:: Cmd.completedefault(text, line, begidx, endidx)
118 Method called to complete an input line when no command-specific
122 .. method:: Cmd.precmd(line)
124 Hook method executed just before the command line *line* is interpreted, but
127 used as the command which will be executed by the :meth:`onecmd` method; the
128 :meth:`precmd` implementation may re-write the command or simply return *line*
132 .. method:: Cmd.postcmd(stop, line)
134 Hook method executed just after a command dispatch is finished. This method is
135 a stub in :class:`Cmd`; it exists to be overridden by subclasses. *line* is the
136 command line which was executed, and *stop* is a flag which indicates whether
164 The string of characters accepted for the command prefix.
169 The last nonempty command prefix seen.
206 The character used to draw separator lines under the help-message headers. If
207 empty, no ruler line is drawn. It defaults to ``'='``.
213 display a prompt and read the next command; if false, :meth:`sys.stdout.write`
216 support :program:`Emacs`\ -like line editing and command-history keystrokes.)