Save the user command text into the command object

Bug #1411095 reported by Dean Troyer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cliff
Fix Released
Wishlist
Dean Troyer

Bug Description

The Command objects do not know what command string the user entered to invoke the Command class. since the user text to class mapping is done in entry points the Command class does not know what invoked it. Sometimes it is useful to know this, especially when multiple command entry points load the same class.

App.run_subclass() pass the command name in the cmd_factory() call.

One use case for this is when subclassing command classes, for example, or to change behaviour through the command name; think of it as symlinking UNIX commands and branching based on the value of $0 or argv[0].

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cliff (master)

Fix proposed to branch: master
Review: https://review.openstack.org/147381

Changed in python-cliff:
assignee: nobody → Dean Troyer (dtroyer)
status: New → In Progress
Changed in python-cliff:
milestone: none → next-kilo
importance: Undecided → Wishlist
Changed in python-cliff:
milestone: 1.10.0 → next-kilo
Changed in python-cliff:
milestone: 1.10.1 → next-liberty
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cliff (master)

Reviewed: https://review.openstack.org/147381
Committed: https://git.openstack.org/cgit/openstack/cliff/commit/?id=91f5ad385b757d2856ee4d2e64f6614e4ad8f7c5
Submitter: Jenkins
Branch: master

commit 91f5ad385b757d2856ee4d2e64f6614e4ad8f7c5
Author: Dean Troyer <email address hidden>
Date: Wed Jan 14 22:50:19 2015 -0600

    Pass user command text to the Command object

    Previously the Command objects did not know what command text was entered
    by the user. That mapping is done in entry points and was thrown away in
    App.run_subcommand().

    This adds cmd_name as an optional keyword arg to Command.__init__() and
    saves it as an attribute. App.run_subcommand() passes in the original
    command text to cmd_factory() and all is well.

    Closes-bug: #1411095
    Change-Id: I36c42b0447652ed3bd71ad6ae0d70db7d27abbad

Changed in python-cliff:
status: In Progress → Fix Committed
Changed in python-cliff:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.