diff options
author | Dean Troyer <dtroyer@gmail.com> | 2015-01-14 22:50:19 -0600 |
---|---|---|
committer | Dean Troyer <dtroyer@gmail.com> | 2015-03-06 12:28:04 -0600 |
commit | 91f5ad385b757d2856ee4d2e64f6614e4ad8f7c5 (patch) | |
tree | c9b87b7a7ccdc0339254312e65538b4b939d8fcd /cliff/tests | |
parent | ed6ab06d2793021d6ab21329b9fad3bb147fbc62 (diff) | |
download | cliff-91f5ad385b757d2856ee4d2e64f6614e4ad8f7c5.tar.gz |
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
Diffstat (limited to 'cliff/tests')
-rw-r--r-- | cliff/tests/test_command.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cliff/tests/test_command.py b/cliff/tests/test_command.py index 39fde51..421a810 100644 --- a/cliff/tests/test_command.py +++ b/cliff/tests/test_command.py @@ -20,3 +20,8 @@ def test_get_parser(): cmd = TestCommand(None, None) parser = cmd.get_parser('NAME') assert parser.prog == 'NAME' + + +def test_get_name(): + cmd = TestCommand(None, None, cmd_name='object action') + assert cmd.cmd_name == 'object action' |