Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
agkyra
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
agkyra
Commits
02d9f06a
Commit
02d9f06a
authored
9 years ago
by
Stavros Sachtouris
Browse files
Options
Downloads
Patches
Plain Diff
Add --version argument in agkyra CLI
parent
666252f8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
agkyra/cli.py
+17
-9
17 additions, 9 deletions
agkyra/cli.py
with
17 additions
and
9 deletions
agkyra/cli.py
+
17
−
9
View file @
02d9f06a
...
@@ -50,7 +50,8 @@ class ConfigCommands(object):
...
@@ -50,7 +50,8 @@ class ConfigCommands(object):
"""
Commands for handling Agkyra config options
"""
"""
Commands for handling Agkyra config options
"""
cnf
=
config
.
AgkyraConfig
()
cnf
=
config
.
AgkyraConfig
()
def
_validate_section
(
self
,
section
,
err_msg
=
'"
%s
"
is not a valid section
'
):
def
_validate_section
(
self
,
section
,
err_msg
=
'"
%s
"
is not a valid section
'
):
"""
:raises ConfigError: if the section is invalid
"""
"""
:raises ConfigError: if the section is invalid
"""
if
not
self
.
cnf
.
has_section
(
section
):
if
not
self
.
cnf
.
has_section
(
section
):
raise
ConfigError
(
err_msg
%
section
)
raise
ConfigError
(
err_msg
%
section
)
...
@@ -159,8 +160,6 @@ class ConfigCommands(object):
...
@@ -159,8 +160,6 @@ class ConfigCommands(object):
return
True
return
True
from
functools
import
wraps
def
handle_UI_error
(
func
):
def
handle_UI_error
(
func
):
def
inner
(
*
args
,
**
kw
):
def
inner
(
*
args
,
**
kw
):
try
:
try
:
...
@@ -198,6 +197,11 @@ class AgkyraCLI(cmd.Cmd):
...
@@ -198,6 +197,11 @@ class AgkyraCLI(cmd.Cmd):
action
=
'
store_true
'
,
help
=
'
set logging level to
"
debug
"'
)
action
=
'
store_true
'
,
help
=
'
set logging level to
"
debug
"'
)
parser
.
add_argument
(
'
cmd
'
,
nargs
=
"
*
"
)
parser
.
add_argument
(
'
cmd
'
,
nargs
=
"
*
"
)
if
not
any
([
a
for
a
in
sys
.
argv
[
1
:]
if
not
a
.
startswith
(
'
-
'
)]):
parser
.
add_argument
(
'
--version
'
,
action
=
'
store_true
'
,
help
=
'
Output agkyra version and exit
'
)
for
terms
in
([
'
help
'
,
],
[
'
config
'
,
'
delete
'
]):
for
terms
in
([
'
help
'
,
],
[
'
config
'
,
'
delete
'
]):
if
not
set
(
terms
).
difference
(
sys
.
argv
):
if
not
set
(
terms
).
difference
(
sys
.
argv
):
{
{
...
@@ -206,7 +210,7 @@ class AgkyraCLI(cmd.Cmd):
...
@@ -206,7 +210,7 @@ class AgkyraCLI(cmd.Cmd):
action
=
'
store_true
'
,
help
=
'
List all commands
'
),
action
=
'
store_true
'
,
help
=
'
List all commands
'
),
'
config_delete
'
:
lambda
:
parser
.
add_argument
(
'
config_delete
'
:
lambda
:
parser
.
add_argument
(
'
--yes
'
,
'
-y
'
,
'
--yes
'
,
'
-y
'
,
action
=
'
store_true
'
,
help
=
'
Yes to all questions
'
)
action
=
'
store_true
'
,
help
=
'
Yes to all questions
'
)
,
}[
'
_
'
.
join
(
terms
)]()
}[
'
_
'
.
join
(
terms
)]()
return
parser
.
parse_args
()
return
parser
.
parse_args
()
...
@@ -256,8 +260,9 @@ class AgkyraCLI(cmd.Cmd):
...
@@ -256,8 +260,9 @@ class AgkyraCLI(cmd.Cmd):
def
do_help
(
self
,
line
):
def
do_help
(
self
,
line
):
"""
Help on agkyra GUI and CLI
"""
Help on agkyra GUI and CLI
agkyra Run agkyra with GUI (equivalent to
"
agkyra gui
"
)
agkyra Run agkyra with GUI (equivalent to
"
agkyra gui
"
)
agkyra <cmd> Run a command through agkyra CLI
agkyra <cmd> Run a command through agkyra CLI
agkyra --version Print agkyra version ans exit
To get help on agkyra commands:
To get help on agkyra commands:
help <cmd> for an individual command
help <cmd> for an individual command
...
@@ -277,9 +282,12 @@ class AgkyraCLI(cmd.Cmd):
...
@@ -277,9 +282,12 @@ class AgkyraCLI(cmd.Cmd):
cmd
.
Cmd
.
do_help
(
self
,
line
)
cmd
.
Cmd
.
do_help
(
self
,
line
)
def
emptyline
(
self
):
def
emptyline
(
self
):
if
self
.
must_help
(
''
):
if
self
.
args
.
version
:
return
from
agkyra
import
__version__
return
self
.
do_gui
(
''
)
sys
.
stdout
.
write
(
'
%s
\n
'
%
__version__
)
sys
.
stdout
.
flush
()
elif
not
self
.
must_help
(
''
):
return
self
.
do_gui
(
''
)
def
default
(
self
,
line
):
def
default
(
self
,
line
):
self
.
do_help
(
line
)
self
.
do_help
(
line
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment