mirror of
https://github.com/p8952/bocker.git
synced 2025-11-09 02:24:01 +01:00
Reduce lines required for command documentation
This commit is contained in:
parent
39ebf616c4
commit
7edff781c1
23
bocker
23
bocker
@ -71,26 +71,21 @@ btrfs subvolume snapshot "$btrfs_path/$1" "$btrfs_path/$2" > /dev/null
|
|||||||
echo "Created: $2"
|
echo "Created: $2"
|
||||||
}
|
}
|
||||||
function HELP() {
|
function HELP() {
|
||||||
echo -e "Create an image: \n\t./bocker init <image_directory>\n"
|
sed -n "s/\\\\n/\n\t/g;s/$/\n/;s/^.*#HELP\\s//p;" < $1
|
||||||
echo -e "List images: \n\t./bocker images\n"
|
|
||||||
echo -e "Create a container: \n\t./bocker run <image_id> <command>\n"
|
|
||||||
echo -e "List containers: \n\t./bocker ps\n"
|
|
||||||
echo -e "View logs from a container: \n\t./bocker logs <container_id>\n"
|
|
||||||
echo -e "Delete an image or container: \n\t./bocker rm <image_or_container_id>"
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
[[ -z "${1-}" ]] && HELP
|
[[ -z "${1-}" ]] && HELP $0
|
||||||
case $1 in
|
case $1 in
|
||||||
init) INIT "$2" ;;
|
init) INIT "$2" ;; #HELP Create an image:\n./bocker init <image_directory>
|
||||||
rm) RM "$2" ;;
|
images) IMAGES ;; #HELP List images:\n./bocker images
|
||||||
images) IMAGES ;;
|
run) #HELP Create a container:\n./bocker run <image_id> <command>
|
||||||
ps) PS ;;
|
|
||||||
run)
|
|
||||||
IMAGE="$2"
|
IMAGE="$2"
|
||||||
shift && shift
|
shift && shift
|
||||||
RUN "$IMAGE" "$*"
|
RUN "$IMAGE" "$*"
|
||||||
;;
|
;;
|
||||||
logs) LOGS "$2" ;;
|
ps) PS ;; #HELP List containers:\n./bocker ps
|
||||||
|
logs) LOGS "$2" ;; #HELP View logs from a container:\n./bocker logs <container_id>
|
||||||
commit) COMMIT "$2" "$3" ;;
|
commit) COMMIT "$2" "$3" ;;
|
||||||
*) HELP ;;
|
rm) RM "$2" ;; #HELP Delete an image or container:\n./bocker rm <image_id or container_id>
|
||||||
|
*) HELP $0 ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user