Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
kamaki
Commits
b01d6eb7
Commit
b01d6eb7
authored
Jan 03, 2013
by
Stavros Sachtouris
Browse files
Merge branch 'develop' into feature-argument
parents
04d01cd4
a38eb14e
Changes
2
Hide whitespace changes
Inline
Side-by-side
kamaki/cli/__init__.py
View file @
b01d6eb7
...
...
@@ -38,7 +38,7 @@ from inspect import getargspec
from
kamaki.cli.argument
import
ArgumentParseManager
from
kamaki.cli.history
import
History
from
kamaki.cli.utils
import
print_dict
,
print_list
,
red
,
magenta
,
yellow
from
kamaki.cli.utils
import
print_dict
,
red
,
magenta
,
yellow
from
kamaki.cli.errors
import
CLIError
_help
=
False
...
...
kamaki/cli/command_shell.py
View file @
b01d6eb7
...
...
@@ -100,6 +100,15 @@ class Shell(Cmd):
def
set_prompt
(
self
,
new_prompt
):
self
.
prompt
=
'%s%s%s'
%
(
self
.
_prefix
,
new_prompt
,
self
.
_suffix
)
def
cmdloop
(
self
):
while
True
:
try
:
Cmd
.
cmdloop
(
self
)
except
KeyboardInterrupt
:
print
(
' - interrupted'
)
continue
break
def
do_exit
(
self
,
line
):
print
(
''
)
if
self
.
prompt
[
len
(
self
.
_prefix
):
-
len
(
self
.
_suffix
)]
\
...
...
@@ -170,7 +179,8 @@ class Shell(Cmd):
cls
=
subcmd
.
get_class
()
ldescr
=
getattr
(
cls
,
'long_description'
,
''
)
if
subcmd
.
path
==
'history_run'
:
instance
=
cls
(
dict
(
cmd_parser
.
arguments
),
instance
=
cls
(
dict
(
cmd_parser
.
arguments
),
self
.
cmd_tree
)
else
:
instance
=
cls
(
dict
(
cmd_parser
.
arguments
))
...
...
@@ -191,10 +201,12 @@ class Shell(Cmd):
arg
.
value
=
getattr
(
cmd_parser
.
parsed
,
name
,
arg
.
default
)
exec_cmd
(
instance
,
[
term
for
term
in
cmd_parser
.
unparsed
\
if
not
term
.
startswith
(
'-'
)]
,
exec_cmd
(
instance
,
cmd_parser
.
unparsed
,
cmd_parser
.
parser
.
print_help
)
#[term for term in cmd_parser.unparsed\
# if not term.startswith('-')],
except
(
ClientError
,
CLIError
)
as
err
:
print_error_message
(
err
)
elif
(
'-h'
in
cmd_args
or
'--help'
in
cmd_args
)
\
...
...
@@ -281,6 +293,7 @@ class Shell(Cmd):
try
:
self
.
cmdloop
()
except
Exception
:
except
Exception
as
e
:
print
(
'(%s)'
%
e
)
from
traceback
import
print_stack
print_stack
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment