You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
808 B
42 lines
808 B
#!/usr/bin/env bash
|
|
|
|
# CONSTANTS
|
|
|
|
CONTAINER_PREFIX=
|
|
TYPE=container
|
|
|
|
# FUNCTIONS
|
|
|
|
function usage {
|
|
echo "$(basename "$0") [CONTAINER_PREFIX] < --vm >"
|
|
}
|
|
|
|
function parse_options {
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--help | -h)
|
|
usage && exit 0
|
|
;;
|
|
--vm)
|
|
TYPE='VIRTUAL-MACHINE'
|
|
;;
|
|
*)
|
|
if [[ -z $CONTAINER_PREFIX ]]; then
|
|
CONTAINER_PREFIX=$1
|
|
else
|
|
echo >&2 "Unknown option: $1" && usage && exit 2
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
shift 1 # Move to the next argument
|
|
done
|
|
}
|
|
|
|
function ls {
|
|
incus list -c ns4 -f compact,noheader "$CONTAINER_PREFIX" type=$TYPE
|
|
}
|
|
# MAIN
|
|
|
|
parse_options "$@"
|
|
ls
|