--mode full/export -> --full / --export

This commit is contained in:
Alexandre Aubin 2021-09-05 18:53:39 +02:00
parent 6276385120
commit 62eecb28db
2 changed files with 19 additions and 9 deletions

View file

@ -863,14 +863,14 @@ app:
key:
help: A specific panel, section or a question identifier
nargs: '?'
-m:
full: --mode
help: Display mode to use
choices:
- classic
- full
- export
default: classic
-f:
full: --full
help: Display all details (meant to be used by the API)
action: store_true
-e:
full: --export
help: Only export key/values, meant to be reimported using "config set --args-file"
action: store_true
### app_config_set()
set:

View file

@ -1751,10 +1751,20 @@ def app_action_run(operation_logger, app, action, args=None):
return logger.success("Action successed!")
def app_config_get(app, key="", mode="classic"):
def app_config_get(app, key="", full=False, export=False):
"""
Display an app configuration in classic, full or export mode
"""
if full and export:
raise YunohostValidationError("You can't use --full and --export together.", raw_msg=True)
if full:
mode = "full"
elif export:
mode = "export"
else:
mode = "classic"
config_ = AppConfigPanel(app)
return config_.get(key, mode)