Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd.py: add instance-specific stdin/out #36630

Closed
anthonybaxter mannequin opened this issue May 21, 2002 · 7 comments
Closed

cmd.py: add instance-specific stdin/out #36630

anthonybaxter mannequin opened this issue May 21, 2002 · 7 comments
Labels
stdlib Python modules in the Lib dir

Comments

@anthonybaxter
Copy link
Mannequin

anthonybaxter mannequin commented May 21, 2002

BPO 558544
Nosy @gvanrossum, @loewis
Files
  • cmd.diff: really, truly a patch this time. really
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2003-02-06.01:52:46.000>
    created_at = <Date 2002-05-21.05:45:14.000>
    labels = ['library']
    title = 'cmd.py: add instance-specific stdin/out'
    updated_at = <Date 2003-02-06.01:52:46.000>
    user = 'https://bugs.python.org/anthonybaxter'

    bugs.python.org fields:

    activity = <Date 2003-02-06.01:52:46.000>
    actor = 'anthonybaxter'
    assignee = 'anthonybaxter'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2002-05-21.05:45:14.000>
    creator = 'anthonybaxter'
    dependencies = []
    files = ['4281']
    hgrepos = []
    issue_num = 558544
    keywords = ['patch']
    message_count = 7.0
    messages = ['40060', '40061', '40062', '40063', '40064', '40065', '40066']
    nosy_count = 3.0
    nosy_names = ['gvanrossum', 'loewis', 'anthonybaxter']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue558544'
    versions = []

    @anthonybaxter
    Copy link
    Mannequin Author

    anthonybaxter mannequin commented May 21, 2002

    The following patch adds stdin, stdout as optional
    arguments to the cmd.Cmd constructor (defaulting to
    sys.stdin, sys.stdout), and changes the Cmd methods
    throughout to use self.stdout.write() and
    self.stdin.foo for output and input. This allows much
    greater flexibility for using cmd - for instance,
    hooking it into a telnet server. And if the response
    is YAGNI, well, actually, IAGNI, because it's in use
    today (and for the last year). :)

    If this is acceptable, I'll provide a documentation
    patch as well.

    @anthonybaxter anthonybaxter mannequin closed this as completed May 21, 2002
    @anthonybaxter anthonybaxter mannequin self-assigned this May 21, 2002
    @anthonybaxter anthonybaxter mannequin added the stdlib Python modules in the Lib dir label May 21, 2002
    @anthonybaxter anthonybaxter mannequin closed this as completed May 21, 2002
    @anthonybaxter anthonybaxter mannequin self-assigned this May 21, 2002
    @anthonybaxter anthonybaxter mannequin added the stdlib Python modules in the Lib dir label May 21, 2002
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Jun 2, 2002

    Logged In: YES
    user_id=21627

    There's no uploaded file! You have to check the
    checkbox labeled "Check to Upload & Attach File"
    when you upload a file.

    Please try again.

    (This is a SourceForge annoyance that we can do
    nothing about. :-( )

    @anthonybaxter
    Copy link
    Mannequin Author

    anthonybaxter mannequin commented Jun 6, 2002

    Logged In: YES
    user_id=29957

    damn. here's patch

    @gvanrossum
    Copy link
    Member

    Logged In: YES
    user_id=6380

    +1. But before you check it in, watch out -- looks like the
    patch is older than current CVS, and it is missing a number
    of improvements that Raymond Hettinger checked in.

    Hm, what's this?

    self.stdout.write('*** Unknown syntax: %s
    (%s)\n'%(str(line),repr(line)))

    Why write the contents of the line twice?

    It also looks like the patch is a reverse diff.

    @anthonybaxter
    Copy link
    Mannequin Author

    anthonybaxter mannequin commented Jun 6, 2002

    Logged In: YES
    user_id=29957

    reverse diff - oops. The str(line) repr(line) bit is because
    when hooking
    it into telnet, sometimes you get wierd control characters
    at the start. The
    str/repr is so that you can actually read the line. I'll
    kill the str() bit.

    @gvanrossum
    Copy link
    Member

    Logged In: YES
    user_id=6380

    OK, go ahead and check it in then. (Modulo the warnings
    below.)

    @anthonybaxter
    Copy link
    Mannequin Author

    anthonybaxter mannequin commented Feb 6, 2003

    Logged In: YES
    user_id=29957

    Checking in Lib/cmd.py;
    /cvsroot/python/python/dist/src/Lib/cmd.py,v <-- cmd.py
    new revision: 1.35; previous revision: 1.34
    done
    Checking in Doc/lib/libcmd.tex;
    /cvsroot/python/python/dist/src/Doc/lib/libcmd.tex,v <--
    libcmd.tex
    new revision: 1.13; previous revision: 1.12

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant