Revision 75c3fc42 kamaki/cli/__init__.py
b/kamaki/cli/__init__.py | ||
---|---|---|
79 | 79 |
|
80 | 80 |
def _num_of_matching_terms(basic_list, attack_list): |
81 | 81 |
if not attack_list: |
82 |
return 1
|
|
82 |
return len(basic_list)
|
|
83 | 83 |
|
84 | 84 |
matching_terms = 0 |
85 | 85 |
for i, term in enumerate(basic_list): |
... | ... | |
379 | 379 |
_exec_cmd(executable, unparsed, parser.print_help) |
380 | 380 |
|
381 | 381 |
|
382 |
from command_shell import _fix_arguments, Shell |
|
383 |
|
|
384 |
|
|
385 |
def _start_shell(): |
|
386 |
shell = Shell() |
|
387 |
shell.set_prompt(basename(argv[0])) |
|
388 |
from kamaki import __version__ as version |
|
389 |
shell.greet(version) |
|
390 |
shell.do_EOF = shell.do_exit |
|
391 |
return shell |
|
392 |
|
|
393 |
|
|
394 |
def run_shell(arguments): |
|
395 |
_fix_arguments() |
|
396 |
shell = _start_shell() |
|
397 |
_config = _arguments['config'] |
|
398 |
from kamaki.cli.command_tree import CommandTree |
|
399 |
shell.cmd_tree = CommandTree( |
|
400 |
'kamaki', 'A command line tool for poking clouds') |
|
382 |
def run_shell(exe_string, arguments): |
|
383 |
from command_shell import _init_shell |
|
384 |
shell = _init_shell(exe_string, arguments) |
|
385 |
# Load all commands in shell CommandTree |
|
386 |
_config = arguments['config'] |
|
401 | 387 |
for spec in [spec for spec in _config.get_groups()\ |
402 |
if arguments['config'].get(spec, 'cli')]:
|
|
388 |
if _config.get(spec, 'cli')]:
|
|
403 | 389 |
try: |
404 | 390 |
spec_module = _load_spec_module(spec, arguments, '_commands') |
405 | 391 |
spec_commands = getattr(spec_module, '_commands') |
... | ... | |
433 | 419 |
parser.print_help() |
434 | 420 |
_groups_help(_arguments) |
435 | 421 |
else: |
436 |
run_shell(_arguments) |
|
422 |
run_shell(exe, _arguments)
|
|
437 | 423 |
except CLIError as err: |
438 | 424 |
if _debug: |
439 | 425 |
raise err |
Also available in: Unified diff