Snapshot descriptions implenented

Snapshots descriptions for snapshot listing implemented
This commit is contained in:
Jarno Rankinen 2020-08-01 20:39:56 +03:00
parent 5701784128
commit c5e4056ba0
1 changed files with 10 additions and 1 deletions

11
snapsh
View File

@ -34,6 +34,10 @@ help() {
Options:
-h, --help Display this help message
-d STR, --description STR Add a description for the snapshot displayed in the
snapshots listing. Must be used before -s, e.g.
snapsh -d "A snapshot" -s root
-s SUBVOL, --snapshot SUBVOL Take a snapshot of subvolume named SUBVOL.
Exit codes:
2 - Invalid options
@ -106,7 +110,7 @@ fi
# Options parsing:
OPTIONS=$(getopt -a -n snapsh -o hs: --long help,snapshot: -- "$@")
OPTIONS=$(getopt -a -n snapsh -o hs:d: --long help,snapshot:,description: -- "$@")
# Invalid options (getopt returns nonzero)
if [[ "$?" -ne 0 ]]; then
@ -125,6 +129,11 @@ while true; do
exit 0
;;
-d | --description)
DESCRIPTION="$2"
shift 2
;;
-s | --snapshot)
SUBVOLUME="$2"
snapshot