Browse Source

fix: [vps] provide better help support for stats, listing available resources

master
Valentin Lab 1 month ago
parent
commit
4c3daa723b
  1. 8
      bin/vps

8
bin/vps

@ -2168,13 +2168,17 @@ awk:require() {
done done
} }
resource:list() {
declare -F | egrep -- '-fx? stats:[a-zA-Z0-9_.-]+$' | cut -f 3- -d " " | cut -f 2- -d ":"
}
cmdline.spec.gnu stats cmdline.spec.gnu stats
cmdline.spec::cmd:stats:run() { cmdline.spec::cmd:stats:run() {
: :optval: --format,-f "Either 'silent', 'raw', or 'pretty', default is pretty." : :optval: --format,-f "Either 'silent', 'raw', or 'pretty', default is pretty."
: :optfla: --silent,-s "Shorthand for '--format silent'" : :optfla: --silent,-s "Shorthand for '--format silent'"
: :optval: --resource,-r 'resource(s) separated with a comma'
: :optval: --resource,-r "resource(s) separated with a comma
(available resources: $(resource:list))"
local project_name service_name containers container check local project_name service_name containers container check
@ -2222,7 +2226,7 @@ cmdline.spec::cmd:stats:run() {
not_found_msg=${not_found_msg%, } not_found_msg=${not_found_msg%, }
err "Unsupported resource(s) provided: ${not_found_msg}" err "Unsupported resource(s) provided: ${not_found_msg}"
echo " resource must be one-of:" >&2 echo " resource must be one-of:" >&2
declare -F | egrep -- '-fx? stats:[a-zA-Z0-9_.-]+$' | cut -f 3- -d " " | cut -f 2- -d ":" | prefix " - " >&2
resource:list | prefix " - " >&2
return 1 return 1
fi fi

Loading…
Cancel
Save