From 62eecb28db3abc9d29541a8fd8d72dcecf227e2f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 5 Sep 2021 18:53:39 +0200 Subject: [PATCH] --mode full/export -> --full / --export --- data/actionsmap/yunohost.yml | 16 ++++++++-------- src/yunohost/app.py | 12 +++++++++++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml index f694d4361..cbb580029 100644 --- a/data/actionsmap/yunohost.yml +++ b/data/actionsmap/yunohost.yml @@ -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: diff --git a/src/yunohost/app.py b/src/yunohost/app.py index d97c2824c..45386c129 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -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)