mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Use getopts for setting's helpers
This commit is contained in:
parent
fe6a414ebf
commit
f24b7a6fda
1 changed files with 35 additions and 13 deletions
|
@ -1,27 +1,49 @@
|
||||||
# Get an application setting
|
# Get an application setting
|
||||||
#
|
#
|
||||||
# usage: ynh_app_setting_get app key
|
# usage: ynh_app_setting_get --app=app --key=key
|
||||||
# | arg: app - the application id
|
# | arg: -a, --app - the application id
|
||||||
# | arg: key - the setting to get
|
# | arg: -k, --key - the setting to get
|
||||||
ynh_app_setting_get() {
|
ynh_app_setting_get() {
|
||||||
sudo yunohost app setting "$1" "$2" --output-as plain --quiet
|
# Declare an array to define the options of this helper.
|
||||||
|
declare -Ar args_array=( [a]=app= [k]=key= )
|
||||||
|
local app
|
||||||
|
local key
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
sudo yunohost app setting "$app" "$key" --output-as plain --quiet
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set an application setting
|
# Set an application setting
|
||||||
#
|
#
|
||||||
# usage: ynh_app_setting_set app key value
|
# usage: ynh_app_setting_set --app=app --key=key --value=value
|
||||||
# | arg: app - the application id
|
# | arg: -a, --app - the application id
|
||||||
# | arg: key - the setting name to set
|
# | arg: -k, --key - the setting name to set
|
||||||
# | arg: value - the setting value to set
|
# | arg: -v, --value - the setting value to set
|
||||||
ynh_app_setting_set() {
|
ynh_app_setting_set() {
|
||||||
sudo yunohost app setting "$1" "$2" --value="$3" --quiet
|
# Declare an array to define the options of this helper.
|
||||||
|
declare -Ar args_array=( [a]=app= [k]=key= [v]=value= )
|
||||||
|
local app
|
||||||
|
local key
|
||||||
|
local value
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
sudo yunohost app setting "$app" "$key" --value="$value" --quiet
|
||||||
}
|
}
|
||||||
|
|
||||||
# Delete an application setting
|
# Delete an application setting
|
||||||
#
|
#
|
||||||
# usage: ynh_app_setting_delete app key
|
# usage: ynh_app_setting_delete --app=app --key=key
|
||||||
# | arg: app - the application id
|
# | arg: -a, --app - the application id
|
||||||
# | arg: key - the setting to delete
|
# | arg: -k, --key - the setting to delete
|
||||||
ynh_app_setting_delete() {
|
ynh_app_setting_delete() {
|
||||||
sudo yunohost app setting -d "$1" "$2" --quiet
|
# Declare an array to define the options of this helper.
|
||||||
|
declare -Ar args_array=( [a]=app= [k]=key= )
|
||||||
|
local app
|
||||||
|
local key
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
sudo yunohost app setting -d "$app" "$key" --quiet
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue