Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-143804: highlight default empty-line command repetition incmd.Cmd documentation#143808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
tanloong wants to merge5 commits intopython:mainfromtanloong:cmd-emptyline
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletionsDoc/library/cmd.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -93,6 +93,18 @@ A :class:`Cmd` instance has the following methods:
are the beginning and ending indexes of the prefix text, which could be used to
provide different completion depending upon which position the argument is in.

.. rubric:: Empty input behavior

When the user enters an empty line in response to the prompt, ``Cmd`` does
**not** ignore the input by default. Instead, it repeats the last non-empty
command entered.

This behavior is implemented by :meth:`Cmd.emptyline`. Subclasses that do not
want empty input to repeat the previous command should override
:meth:`Cmd.emptyline` to do nothing::

def emptyline(self):
pass

.. method:: Cmd.do_help(arg)

Expand DownExpand Up@@ -127,6 +139,8 @@ A :class:`Cmd` instance has the following methods:
Method 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.

Note that if :meth:`emptyline` is not overridden, empty input will cause
the previous command to be repeated and passed again to this method.

.. method:: Cmd.completedefault(text, line, begidx, endidx)

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
Clarified the documentation of :mod:`cmd` regarding the default handling of
empty input lines.
Loading

[8]ページ先頭

©2009-2026 Movatter.jp