aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRatakor <ratakor@disroot.org>2023-03-30 18:50:39 +0200
committerRatakor <ratakor@disroot.org>2023-03-30 18:50:39 +0200
commit4463872d59fecb763b579bfd59d454ecfd6d2851 (patch)
treeafb0f6aa0250555239ef5aeddfff60f6d0d5a8ee
parent4f9192075fb5b8c415063ccd18fd146f8ceeecf7 (diff)
handle weekly event
-rw-r--r--README.md21
-rwxr-xr-xquand10
2 files changed, 21 insertions, 10 deletions
diff --git a/README.md b/README.md
index 5f9219b..944f180 100644
--- a/README.md
+++ b/README.md
@@ -15,20 +15,27 @@ $ cd quand
## Example of calendar file:
Any line that does not respect the 'yyyy mm dd' format will simply be ignored.
+The comma is not necessary, I just like it.
```
# Don't forget the 0 behind month or day
2023 04 28, 07:30 -> 09:30 English
-2023 03 12 Dentist
+2023 03 12, Dentist
-# use a star for events that happen once a year
-* 08 10 Mum's anniversary
-* 07 14 Bastille Day
+# For events that happen once a week:
+# The name of each day depends on your locale
+Mon, don't forget to update with pacman -Syyu
+Fri, it's friday!
-# use 2 stars for events that happen once a month
-* * 01 Happy New Month!
+# Use a star for events that happen once a year:
+* 08 10, Mum's anniversary
+* 07 14, Bastille Day
-# use 3 stars to always show an event
+# Use 2 stars for events that happen once a month:
+* * 01, Happy New Month!
+
+# Use 3 stars to always show an event:
* * * Good Morning :)
+* * * 2023 03 31, URGENT don't forget your meeting
```
## Configuration
diff --git a/quand b/quand
index 11b8f78..9cbeb5b 100755
--- a/quand
+++ b/quand
@@ -46,9 +46,12 @@ print() {
"$1 $2 $3"*)
printf "${5:-$4}\033[m%s\n" "$line" ;;
"* $2 $3"*)
- printf "${5:-$4}\033[m%s\n" "$1 ${line#"* "}" ;;
+ printf "${5:-$4}\033[m%s\n" "$1${line#"*"}" ;;
"* * $3"*)
- printf "${5:-$4}\033[m%s\n" "$1 $2 ${line#"* * "}" ;;
+ printf "${5:-$4}\033[m%s\n" "$1 $2${line#"* *"}" ;;
+ "${4%"$spaces"}"*)
+ printf "${5:-$4}\033[m%s\n"\
+ "$1 $2 $3${line#"${4%"$spaces"}"}" ;;
esac
done
}
@@ -74,7 +77,8 @@ no option | Default
e|edit | Edit the calendar file
c|cal [n] | Print a calendar with 1 or n months
-Have a look at the README for more information about the configuration.\n' "${0##*/}" 1>&2
+Have a look at the README for more information about the configuration.\n'\
+ "${0##*/}" 1>&2
}
main() {