Browse Source

new: [vps] add ``vps monujo set-version`` command

journalctl_limit
Valentin Lab 10 months ago
parent
commit
ae6e5e7627
  1. 35
      bin/vps

35
bin/vps

@ -147,6 +147,12 @@ compose:has-container-project-myc() {
[[ $'\n'"$projects"$'\n' == *$'\n'"myc"$'\n'* ]]
}
compose:service:exists() {
local project="$1" service="$2" service_cfg
service_cfg=$(cat "$(compose:get-compose-yml)" |
shyaml get-value -y "$service" 2>/dev/null) || return 1
[ -n "$service_cfg" ]
}
compose:file:value-change() {
local key="$1" value="$2"
@ -2517,4 +2523,33 @@ cmdline.spec::cmd:bench:run() {
}
cmdline.spec::cmd:monujo:run() {
:
}
cmdline.spec.gnu monujo
cmdline.spec:monujo:cmd:set-version:run() {
: :posarg: TARGET_VERSION "Target version to put in options"
: :optval: --service,-s "The monujo service name (defaults to 'monujo')"
local URL
monujo_service="${opt_service:-monujo}"
project_name=$(compose:project_name) || exit 1
## check if service exists in compose.yml
compose:service:exists "$project_name" "$monujo_service" || {
err "Service '$monujo_service' was not found in current 'compose.yml'."
exit 1
}
Wrap -d "Changing ${DARKYELLOW}$monujo_service${NORMAL} version" -- \
compose:file:value-change \
"${monujo_service}.options.version" \
"${TARGET_VERSION}" || exit 1
}
cmdline::parse "$@"
Loading…
Cancel
Save