From c5e4056ba0e967fce6530023d3b6ec100413abcc Mon Sep 17 00:00:00 2001 From: Jarno Rankinen Date: Sat, 1 Aug 2020 20:39:56 +0300 Subject: [PATCH] Snapshot descriptions implenented Snapshots descriptions for snapshot listing implemented --- snapsh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/snapsh b/snapsh index 87eb574..e3616d3 100755 --- a/snapsh +++ b/snapsh @@ -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