Revision b46307af kamaki/cli/__init__.py
b/kamaki/cli/__init__.py | ||
---|---|---|
57 | 57 |
from .utils import bold, magenta, red, yellow, print_list, print_dict |
58 | 58 |
from .command_tree import CommandTree |
59 | 59 |
from argument import _arguments, parse_known_args |
60 |
from .history import History |
|
60 | 61 |
|
61 | 62 |
cmd_spec_locations = [ |
62 | 63 |
'kamaki.cli.commands', |
... | ... | |
187 | 188 |
|
188 | 189 |
def load_group_package(group, reload_package=False): |
189 | 190 |
spec_pkg = _arguments['config'].value.get(group, 'cli') |
191 |
if spec_pkg is None: |
|
192 |
return None |
|
190 | 193 |
for location in cmd_spec_locations: |
191 | 194 |
location += spec_pkg if location == '' else ('.'+spec_pkg) |
192 | 195 |
try: |
... | ... | |
246 | 249 |
_help = False |
247 | 250 |
_verbose = False |
248 | 251 |
try: |
249 |
|
|
250 | 252 |
exe = basename(argv[0]) |
251 | 253 |
parser = _init_parser(exe) |
252 | 254 |
parsed, unparsed = parse_known_args(parser) |
253 |
_history = _arguments['history'] |
|
254 |
if _history.value: |
|
255 |
cmd_list = [term for term in argv if term not in _history.parsed_name] |
|
256 |
print_list(_history.get(' '.join(cmd_list))) |
|
257 |
_arguments['history'].add(' '.join(argv)) |
|
258 |
exit(0) |
|
259 |
_arguments['history'].add(' '.join(argv)) |
|
255 |
_history = History(_arguments['config'].get('history', 'file')) |
|
256 |
_history.add(' '.join([exe]+argv[1:])) |
|
260 | 257 |
_debug = _arguments['debug'].value |
261 | 258 |
_help = _arguments['help'].value |
262 | 259 |
_verbose = _arguments['verbose'].value |
Also available in: Unified diff