Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.cmdline
Commits
bd3140f9
Commit
bd3140f9
authored
May 22, 2018
by
Flavio TARSETTI
Browse files
[all_packages] added set options to use first the value set in the config file
parent
c9ca1c80
Pipeline
#20406
passed with stages
in 27 minutes and 24 seconds
Changes
11
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
beat/cmdline/algorithms.py
View file @
bd3140f9
...
...
@@ -359,7 +359,7 @@ def process(args):
return
common
.
display_local_path
(
args
[
'config'
].
path
,
'algorithm'
,
args
[
'<name>'
])
elif
args
[
'edit'
]:
return
common
.
edit_local_file
(
args
[
'config'
].
path
,
'algorithm'
,
args
[
'<name>'
][
0
])
return
common
.
edit_local_file
(
args
[
'config'
].
path
,
args
[
'config'
].
editor
,
'algorithm'
,
args
[
'<name>'
][
0
])
elif
args
[
'check'
]:
return
common
.
check
(
args
[
'config'
].
path
,
'algorithm'
,
args
[
'<name>'
])
...
...
beat/cmdline/common.py
View file @
bd3140f9
...
...
@@ -526,7 +526,7 @@ def display_local_path(prefix, type, names):
return
0
def
edit_local_file
(
prefix
,
type
,
name
):
def
edit_local_file
(
prefix
,
editor
,
type
,
name
):
'''Implements the local "path" command
...
...
@@ -574,14 +574,15 @@ def edit_local_file(prefix, type, name):
try
:
if
os
.
path
.
isfile
(
object_path
):
# check if editor set
if
len
(
os
.
environ
[
'VISUAL'
])
>
0
:
editor
=
os
.
environ
[
'VISUAL'
]
elif
len
(
os
.
environ
[
'EDITOR'
])
>
0
:
editor
=
os
.
environ
[
'EDITOR'
]
else
:
logger
.
error
(
"No default editor set in your environment variable"
)
return
1
logger
.
info
(
"Editing object of type '%s' and name '%s':"
,
selected_type
,
name
)
if
editor
is
None
:
if
len
(
os
.
environ
[
'VISUAL'
])
>
0
:
editor
=
os
.
environ
[
'VISUAL'
]
elif
len
(
os
.
environ
[
'EDITOR'
])
>
0
:
editor
=
os
.
environ
[
'EDITOR'
]
else
:
logger
.
error
(
"No default editor set in your environment variable"
)
return
1
logger
.
info
(
"Editing object of type '%s' and name '%s'"
,
selected_type
,
name
)
cmd
=
"%s %s"
%
(
editor
,
object_path
)
os
.
system
(
cmd
)
else
:
...
...
beat/cmdline/config.py
View file @
bd3140f9
...
...
@@ -82,6 +82,7 @@ DEFAULTS = {
'token'
:
None
,
'prefix'
:
os
.
path
.
realpath
(
os
.
path
.
join
(
os
.
curdir
,
'prefix'
)),
'cache'
:
'cache'
,
'editor'
:
None
,
}
"""Default values for the command-line utility"""
...
...
@@ -92,6 +93,7 @@ DOC = {
'token'
:
'Secret key of the user on the BEAT platform'
,
'prefix'
:
'Directory containing BEAT objects'
,
'cache'
:
'Directory to use for data caching (relative to prefix)'
,
'editor'
:
'Editor to be used to edit local files'
,
}
"""Documentation for configuration parameters"""
...
...
beat/cmdline/databases.py
View file @
bd3140f9
...
...
@@ -648,7 +648,7 @@ def process(args):
return
common
.
display_local_path
(
configuration
.
path
,
'database'
,
db_names
)
elif
args
[
'edit'
]:
return
common
.
edit_local_file
(
configuration
.
path
,
'database'
,
db_names
[
0
])
return
common
.
edit_local_file
(
configuration
.
path
,
configuration
.
editor
,
'database'
,
db_names
[
0
])
elif
args
[
'check'
]:
return
common
.
check
(
configuration
.
path
,
'database'
,
db_names
)
...
...
beat/cmdline/dataformats.py
View file @
bd3140f9
...
...
@@ -159,7 +159,7 @@ def process(args):
return
common
.
display_local_path
(
args
[
'config'
].
path
,
'dataformat'
,
args
[
'<name>'
])
elif
args
[
'edit'
]:
return
common
.
edit_local_file
(
args
[
'config'
].
path
,
'dataformat'
,
args
[
'<name>'
][
0
])
return
common
.
edit_local_file
(
args
[
'config'
].
path
,
args
[
'config'
].
editor
,
'dataformat'
,
args
[
'<name>'
][
0
])
elif
args
[
'check'
]:
return
common
.
check
(
args
[
'config'
].
path
,
'dataformat'
,
args
[
'<name>'
])
...
...
beat/cmdline/experiments.py
View file @
bd3140f9
...
...
@@ -606,7 +606,7 @@ def process(args):
return
common
.
display_local_path
(
config
.
path
,
'experiment'
,
names
)
elif
args
[
'edit'
]:
return
common
.
edit_local_file
(
config
.
path
,
'experiment'
,
names
[
0
])
return
common
.
edit_local_file
(
config
.
path
,
config
.
editor
,
'experiment'
,
names
[
0
])
elif
args
[
'check'
]:
return
common
.
check
(
config
.
path
,
'experiment'
,
names
)
...
...
beat/cmdline/libraries.py
View file @
bd3140f9
...
...
@@ -154,7 +154,7 @@ def process(args):
return
common
.
display_local_path
(
args
[
'config'
].
path
,
'library'
,
args
[
'<name>'
])
elif
args
[
'edit'
]:
return
common
.
edit_local_file
(
args
[
'config'
].
path
,
'library'
,
args
[
'<name>'
][
0
])
return
common
.
edit_local_file
(
args
[
'config'
].
path
,
args
[
'config'
].
editor
,
'library'
,
args
[
'<name>'
][
0
])
elif
args
[
'check'
]:
return
common
.
check
(
args
[
'config'
].
path
,
'library'
,
args
[
'<name>'
])
...
...
beat/cmdline/plotterparameters.py
View file @
bd3140f9
...
...
@@ -121,7 +121,7 @@ def process(args):
return
common
.
display_local_path
(
args
[
'config'
].
path
,
'plotterparameter'
,
args
[
'<name>'
])
elif
args
[
'edit'
]:
return
common
.
edit_local_file
(
args
[
'config'
].
path
,
'plotterparameter'
,
args
[
'<name>'
][
0
])
return
common
.
edit_local_file
(
args
[
'config'
].
path
,
args
[
'config'
].
editor
,
'plotterparameter'
,
args
[
'<name>'
][
0
])
elif
args
[
'check'
]:
return
common
.
check
(
args
[
'config'
].
path
,
'plotterparameter'
,
args
[
'<name>'
])
...
...
beat/cmdline/plotters.py
View file @
bd3140f9
...
...
@@ -286,7 +286,7 @@ def process(args):
return
common
.
display_local_path
(
args
[
'config'
].
path
,
'plotter'
,
args
[
'<name>'
])
elif
args
[
'edit'
]:
return
common
.
edit_local_file
(
args
[
'config'
].
path
,
'plotter'
,
args
[
'<name>'
][
0
])
return
common
.
edit_local_file
(
args
[
'config'
].
path
,
args
[
'config'
].
editor
,
'plotter'
,
args
[
'<name>'
][
0
])
elif
args
[
'check'
]:
return
common
.
check
(
args
[
'config'
].
path
,
'plotter'
,
args
[
'<name>'
])
...
...
beat/cmdline/scripts/beat.py
View file @
bd3140f9
...
...
@@ -30,7 +30,7 @@
Usage:
%(prog)s [--verbose ...] [--prefix=<path>] [--cache=<path>] [--user=<user>]
[--platform=<url>] [--token=<token>]
[--platform=<url>] [--token=<token>]
[--editor=<editor>]
[--test-mode] <command> [<args>...]
%(prog)s (--help | -h)
%(prog)s (--version | -V)
...
...
@@ -49,6 +49,9 @@ Options:
-t, --token=<token> Overrides the user token for server operations. If not
set, use the value from your RC file. There are no
defaults for this option.
-e, --editor=<editor> Overrides the user editor to edit local files. If not
set, use the value from your environment. There are no
defaults for this option.
-u, --user=<user> Overrides the user name on the remote platform. If not
set, use the value from your RC file.
[default: %(user)s]
...
...
beat/cmdline/toolchains.py
View file @
bd3140f9
...
...
@@ -84,7 +84,7 @@ def process(args):
return
common
.
display_local_path
(
args
[
'config'
].
path
,
'toolchain'
,
args
[
'<name>'
])
elif
args
[
'edit'
]:
return
common
.
edit_local_file
(
args
[
'config'
].
path
,
'toolchain'
,
args
[
'<name>'
][
0
])
return
common
.
edit_local_file
(
args
[
'config'
].
path
,
args
[
'config'
].
editor
,
'toolchain'
,
args
[
'<name>'
][
0
])
elif
args
[
'check'
]:
return
common
.
check
(
args
[
'config'
].
path
,
'toolchain'
,
args
[
'<name>'
])
...
...
Write
Preview
Supports
Markdown
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