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
71882bca
Commit
71882bca
authored
Nov 14, 2012
by
Stavros Sachtouris
Browse files
Apply total error handling
parent
4f6a21f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
kamaki/cli/__init__.py
View file @
71882bca
...
...
@@ -320,10 +320,6 @@ def _exec_cmd(instance, cmd_args, help_method):
help_method
()
else
:
raise
except
CLIError
as
err
:
if
_debug
:
raise
err
_print_error_message
(
err
)
return
1
...
...
@@ -419,21 +415,31 @@ def run_shell(arguments):
def
main
():
exe
=
basename
(
argv
[
0
])
parser
=
init_parser
(
exe
,
_arguments
)
parsed
,
unparsed
=
parse_known_args
(
parser
,
_arguments
)
if
_arguments
[
'version'
].
value
:
exit
(
0
)
_init_session
(
_arguments
)
if
unparsed
:
_history
=
History
(
_arguments
[
'config'
].
get
(
'history'
,
'file'
))
_history
.
add
(
' '
.
join
([
exe
]
+
argv
[
1
:]))
one_cmd
(
parser
,
unparsed
,
_arguments
)
elif
_help
:
parser
.
print_help
()
_groups_help
(
_arguments
)
else
:
run_shell
(
_arguments
)
try
:
exe
=
basename
(
argv
[
0
])
parser
=
init_parser
(
exe
,
_arguments
)
parsed
,
unparsed
=
parse_known_args
(
parser
,
_arguments
)
if
_arguments
[
'version'
].
value
:
exit
(
0
)
_init_session
(
_arguments
)
if
unparsed
:
_history
=
History
(
_arguments
[
'config'
].
get
(
'history'
,
'file'
))
_history
.
add
(
' '
.
join
([
exe
]
+
argv
[
1
:]))
one_cmd
(
parser
,
unparsed
,
_arguments
)
elif
_help
:
parser
.
print_help
()
_groups_help
(
_arguments
)
else
:
run_shell
(
_arguments
)
except
CLIError
as
err
:
if
_debug
:
raise
err
_print_error_message
(
err
)
exit
(
1
)
except
Exception
as
err
:
if
_debug
:
raise
err
print
(
'Unknown Error: %s'
%
err
)
kamaki/cli/argument.py
View file @
71882bca
...
...
@@ -153,7 +153,7 @@ class CmdLineConfigArgument(Argument):
keypath
,
sep
,
val
=
option
.
partition
(
'='
)
if
not
sep
:
raise
CLISyntaxError
(
'Argument Syntax Error '
,
details
=
'%s is missing a "="
"
(usage: -o section.key=val)'
\
details
=
'%s is missing a "=" (usage: -o section.key=val)'
\
%
option
)
section
,
sep
,
key
=
keypath
.
partition
(
'.'
)
if
not
sep
:
...
...
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