diff options
author | Ratakor <ratakor@disroot.org> | 2023-03-30 01:32:56 +0200 |
---|---|---|
committer | Ratakor <ratakor@disroot.org> | 2023-03-30 01:32:56 +0200 |
commit | 4f9192075fb5b8c415063ccd18fd146f8ceeecf7 (patch) | |
tree | 4fd86c6627f9222d59825d14e733c0a882c7c658 | |
parent | 957348e40fe650ada1309af2a050464e1e266190 (diff) |
fix: add Error if no arg is given to -p and -f options
-rwxr-xr-x | quand | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -68,8 +68,8 @@ Options: no option | Default -h|--help │ Print this help message and exit -v|--version | Print the version --p|--past | Temporarily change past --f|--future | Temporarily change future +-p|--past [n] | Temporarily change past (n is negative) +-f|--future [n] | Temporarily change future (n is positive) | e|edit | Edit the calendar file c|cal [n] | Print a calendar with 1 or n months @@ -94,9 +94,15 @@ main() { calendar "$2" return ;; -p|--past) + [ -z "$2" ] && + printf 'Error: no argument given\n' 1>&2 && + return 1 past="$2" exec ;; -f|--future) + [ -z "$2" ] && + printf 'Error: no argument given\n' 1>&2 && + return 1 future="$2" exec ;; '') |