mirror of
https://gitlab.com/psuapp/psu.git
synced 2024-08-30 18:12:34 +00:00
Add the "actions" action
To list the available actions of psu
This commit is contained in:
parent
7dd1c16a8d
commit
31947b4702
41
psu
41
psu
@ -26,7 +26,7 @@ set -e
|
|||||||
############################
|
############################
|
||||||
main() {
|
main() {
|
||||||
VERSION="0.2.0-alpha.2"
|
VERSION="0.2.0-alpha.2"
|
||||||
ACTIONS="deploy undeploy list info status services tasks tasks:healthy containers help version"
|
ACTIONS="deploy undeploy list info status services tasks tasks:healthy containers actions help version"
|
||||||
|
|
||||||
set_globals "$@"
|
set_globals "$@"
|
||||||
|
|
||||||
@ -423,16 +423,25 @@ inputs() {
|
|||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
actions)
|
||||||
|
ACTION="actions"
|
||||||
|
echo "Portainer Stack Utils, version $VERSION"
|
||||||
|
echo ""
|
||||||
|
echo "Available actions:"
|
||||||
|
for action in $ACTIONS; do
|
||||||
|
echo " $action"
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
-V|--version|version)
|
-V|--version|version)
|
||||||
local message
|
if [ -z "$ACTION" ]; then
|
||||||
local version_message
|
|
||||||
message="Portainer Stack Utils, version $VERSION
|
|
||||||
License GPLv3: GNU GPL version 3"
|
|
||||||
version_message="$(input_message "$1" "$message")"
|
|
||||||
if [ -n "$version_message" ]; then
|
|
||||||
ACTION="version"
|
ACTION="version"
|
||||||
echo "$version_message"
|
echo "Portainer Stack Utils, version $VERSION
|
||||||
|
License GPLv3: GNU GPL version 3"
|
||||||
exit 0
|
exit 0
|
||||||
|
else
|
||||||
|
input_error "Error: invalid option '$1' for the '$ACTION' action"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
-h|--help|help)
|
-h|--help|help)
|
||||||
@ -507,7 +516,7 @@ inputs() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
input_error "Error: Invalid argument: '$1', run the 'psu help' command for more information"
|
input_error "Error: Unknown action '$1', run the 'psu help' command for more information"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
esac
|
esac
|
||||||
@ -585,20 +594,6 @@ input_flag() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
input_message() {
|
|
||||||
local option
|
|
||||||
local value
|
|
||||||
option="$1"
|
|
||||||
value="$2"
|
|
||||||
|
|
||||||
if [ -z "$ACTION" ]; then
|
|
||||||
echo "$value"
|
|
||||||
else
|
|
||||||
input_error "Error: invalid option '$option' for the '$ACTION' action"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
input_error() {
|
input_error() {
|
||||||
local message
|
local message
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user