-# Copyright 2012-2013 GRNET S.A. All rights reserved.
+# Copyright 2012-2014 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
from cmd import Cmd
from os import popen
-from sys import stdout, stderr
+from sys import stdout
from kamaki.cli import exec_cmd, print_error_message, print_subcommands_help
from kamaki.cli.argument import ArgumentParseManager
-from kamaki.cli.utils import print_dict, split_input
+from kamaki.cli.utils import print_dict, split_input, pref_enc
from kamaki.cli.history import History
from kamaki.cli.errors import CLIError
from kamaki.clients import ClientError
tmp_args.pop('verbose', None)
tmp_args.pop('silent', None)
tmp_args.pop('config', None)
- print 'YOLO >>>\n\t', '\n\t'.join([
- ('%s %s %s' % k, v, v.value) for k, v in args.items()])
help_parser = ArgumentParseManager(
- cmd_name, tmp_args, required, syntax=syntax, description=descr)
+ cmd_name, tmp_args, required,
+ syntax=syntax, description=descr, check_required=False)
return help_parser.print_help
def _register_command(self, cmd_path):
<cmd> <term> <term> <args> is always parsed to most specific
even if cmd_term_term is not a terminal path
"""
+ line = line.decode(pref_enc)
subcmd, cmd_args = cmd.parse_out(split_input(line))
self._history.add(' '.join([cmd.path.replace('_', ' '), line]))
cmd_parser = ArgumentParseManager(
self.auth_base = auth_base
self.cloud = cloud
self._parser = parser
- self._history = History(
- parser.arguments['config'].get('global', 'history_file'))
+ cnf = parser.arguments['config']
+ self._history = History(cnf.get('global', 'history_file'))
+ self._history.limit = cnf.get('global', 'history_limit')
if path:
cmd = self.cmd_tree.get_command(path)
intro = cmd.path.replace('_', ' ')