Revision 67cea04c
b/kamaki/cli/__init__.py | ||
---|---|---|
53 | 53 |
|
54 | 54 |
#from kamaki import clients |
55 | 55 |
from .errors import CLIError, CLISyntaxError, CLICmdIncompleteError, CLICmdSpecError |
56 |
from .config import Config #TO BE REMOVED |
|
57 |
from .utils import bold, magenta, red, yellow, print_list, print_dict |
|
56 |
from .utils import bold, magenta, red, yellow, print_list, print_dict, remove_colors |
|
58 | 57 |
from .command_tree import CommandTree |
59 | 58 |
from .argument import _arguments, parse_known_args |
60 | 59 |
from .history import History |
... | ... | |
270 | 269 |
exe = basename(argv[0]) |
271 | 270 |
parser = _init_parser(exe) |
272 | 271 |
parsed, unparsed = parse_known_args(parser, _arguments) |
272 |
_colors = _arguments['config'].get('global', 'colors') |
|
273 |
if _colors!='on': |
|
274 |
remove_colors() |
|
273 | 275 |
_history = History(_arguments['config'].get('history', 'file')) |
274 | 276 |
_history.add(' '.join([exe]+argv[1:])) |
275 | 277 |
_debug = _arguments['debug'].value |
b/kamaki/cli/commands/config_cli.py | ||
---|---|---|
69 | 69 |
|
70 | 70 |
def main(self, option, value): |
71 | 71 |
section, sep, key = option.rpartition('.') |
72 |
section = section or 'globail'
|
|
72 |
section = section or 'global' |
|
73 | 73 |
self.config.set(section, key, value) |
74 | 74 |
self.config.write() |
75 | 75 |
|
b/kamaki/cli/commands/pithos_cli.py | ||
---|---|---|
40 | 40 |
#set_api_description('store', 'Pithos+ storage commands') |
41 | 41 |
API_DESCRIPTION = dict(store='Pithos+ storage commands') |
42 | 42 |
from kamaki.clients.pithos import PithosClient, ClientError |
43 |
from colors import bold
|
|
43 |
from kamaki.cli.utils import bold
|
|
44 | 44 |
from sys import stdout, exit |
45 | 45 |
import signal |
46 | 46 |
from time import localtime, strftime, strptime, mktime |
b/kamaki/cli/utils.py | ||
---|---|---|
38 | 38 |
return val |
39 | 39 |
red = yellow = magenta = bold |
40 | 40 |
|
41 |
|
|
41 |
def remove_colors(): |
|
42 |
global bold |
|
43 |
def dummy(val): |
|
44 |
return val |
|
45 |
bold = dummy |
|
42 | 46 |
|
43 | 47 |
def pretty_keys(d, delim='_', recurcive=False): |
44 | 48 |
"""Transform keys of a dict from the form |
b/kamaki/clients/tests.py | ||
---|---|---|
827 | 827 |
r = self.client.get_network_details(self.network1['id']) |
828 | 828 |
net1 = dict(self.network1) |
829 | 829 |
net1.pop('status') |
830 |
self.assert_dicts_are_deeply_equal(net1, r) |
|
831 | 830 |
net1.pop('updated') |
832 | 831 |
net1.pop('attachments') |
833 | 832 |
r.pop('status') |
834 | 833 |
r.pop('updated') |
835 | 834 |
r.pop('attachments') |
836 |
print('\nNOW COMPARE THE FOLLOWING\n') |
|
837 |
print(net1) |
|
838 |
print('\n') |
|
839 |
print(r) |
|
840 |
print('\n') |
|
841 | 835 |
self.assert_dicts_are_deeply_equal(net1, r) |
842 | 836 |
|
843 | 837 |
@if_not_all |
Also available in: Unified diff