[issue13214] Cmd: list available completions from the cmd.Cmd subclass and filter out EOF handler(s)

2019-11-06 Thread Roundup Robot
Change by Roundup Robot : -- pull_requests: +16584 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17074 ___ Python tracker ___

[issue13214] Cmd: list available completions from the cmd.Cmd subclass and filter out EOF handler(s)

2019-09-27 Thread Kimball Leavitt
Kimball Leavitt added the comment: I know that many people do something like: def do_EOF(self, arg): return True to exit the program when you press Ctrl+d. Others might prefer something like ngie https://bugs.python.org/issue13214#msg145856: def do_EOF(self, arg): raise EOFError

[issue13214] Cmd: list available completions from the cmd.Cmd subclass and filter out EOF handler(s)

2019-05-29 Thread Aldwin Pollefeyt
Aldwin Pollefeyt added the comment: The EOF mentioned in msg309788 is the first reason why I searched in the library code for a solution. Then saw it as an opportunity to create hidden functions in the shell. So I created issue37030 [0] and PR13536 [1]. Later got notified about this thread.

[issue13214] Cmd: list available completions from the cmd.Cmd subclass and filter out EOF handler(s)

2018-01-11 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: rhettinger -> ___ Python tracker ___

[issue13214] Cmd: list available completions from the cmd.Cmd subclass and filter out EOF handler(s)

2018-01-10 Thread Daniel
Daniel added the comment: If you write a handler for EOF like so: from cmd import Cmd class FooShell(Cmd): def do_EOF(self, args): # exit on EOF raise SystemExit() shell = FooShell() shell.cmdloop() Then when running the shell, you

[issue13214] Cmd: list available completions from the cmd.Cmd subclass and filter out EOF handler(s)

2012-07-30 Thread Catherine Devlin
Catherine Devlin added the comment: Needed to update the patch slightly for Python 3; now that filter() returns an iterator, ``do_help``'s call to names = self.get_names() followed by names.sort() was throwing an error, so I changed get_names to return a list. -- nosy:

[issue13214] Cmd: list available completions from the cmd.Cmd subclass and filter out EOF handler(s)

2012-07-30 Thread Catherine Devlin
Catherine Devlin added the comment: Change to test_cmd.py to test for help displaying the name of the registered subcommand (as well as a simple test for the basic operation of the registered sub-CLI). -- Added file: http://bugs.python.org/file26594/test_cmd.patch

[issue13214] Cmd: list available completions from the cmd.Cmd subclass and filter out EOF handler(s)

2011-10-20 Thread Garrett Cooper
Garrett Cooper yaneg...@gmail.com added the comment: Here's a version incorporating your suggestion and better documenting the choices and the method for overriding purposes. I have a few reservations with the current implementation: 1. As noted, the information for the class really could be

[issue13214] Cmd: list available completions from the cmd.Cmd subclass and filter out EOF handler(s)

2011-10-18 Thread Garrett Cooper
New submission from Garrett Cooper yaneg...@gmail.com: 1. The current code in cmd.get_names does a dir on the derived class for cmd.Cmd object instead, which means that if I do something similar to the following: class CLI(cmd.Cmd): def register_subcommand(self, cmd, cli_class):

[issue13214] Cmd: list available completions from the cmd.Cmd subclass and filter out EOF handler(s)

2011-10-18 Thread Raymond Hettinger
Raymond Hettinger raymond.hettin...@gmail.com added the comment: This looks to be a reasonable request. I think the patch would be better if the filtering were done directly in get_names(). A subclass can override or extend that method if it wants to customize the filter. --