Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "Expose load_commands publicly"
- Loading branch information
Showing
4 changed files
with
55 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
from cliff.command import Command | ||
from cliff.commandmanager import CommandManager | ||
|
||
TEST_NAMESPACE = 'cliff.test' | ||
|
||
|
||
class TestParser(object): | ||
|
||
def print_help(self, stdout): | ||
stdout.write('TestParser') | ||
|
||
|
||
class TestCommand(Command): | ||
|
||
def get_parser(self, ignore): | ||
# Make it look like this class is the parser | ||
# so parse_args() is called. | ||
return TestParser() | ||
|
||
def take_action(self, args): | ||
return | ||
|
||
|
||
class TestCommandManager(CommandManager): | ||
|
||
def load_commands(self, namespace): | ||
if namespace == TEST_NAMESPACE: | ||
for key in ('one', 'two words', 'three word command'): | ||
self.add_command(key, TestCommand) |