[enh] new command to list apps action

This commit is contained in:
Laurent Peuch 2018-05-30 10:38:30 +02:00
parent 2056e0272b
commit eef1b6d658
2 changed files with 37 additions and 0 deletions

View file

@ -773,6 +773,18 @@ app:
subcategories:
action:
subcategory_help: Handle apps actions
actions:
### app_action_list()
list:
action_help: List app actions
api: GET /<app>/actions
arguments:
app_id:
help: app id
config:
subcategory_help: Applications configuration panel
actions:

View file

@ -1367,6 +1367,31 @@ def app_change_label(auth, app, new_label):
app_ssowatconf(auth)
# ACTIONS todo list
# * save actions.json
# commands:
# yunohost app action list $app
# yunohost app action run $app $action -d parameters
# docstring
def app_action_list(app_id):
installed = _is_installed(app_id)
if not installed:
raise MoulinetteError(errno.ENOPKG,
m18n.n('app_not_installed', app=app_id))
actions = os.path.join( APPS_SETTING_PATH, app_id, 'actions.json')
if not os.path.exists(actions):
return {
"actions": [],
}
return {
"actions": read_json(actions),
}
# Config panel todo list:
# * docstrings
# * merge translations on the json once the workflow is in place