aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/store.md18
-rw-r--r--functions/__mark_new_store.fish18
2 files changed, 23 insertions, 13 deletions
diff --git a/doc/store.md b/doc/store.md
index f5d70f8..5cb1cb6 100644
--- a/doc/store.md
+++ b/doc/store.md
@@ -38,14 +38,9 @@ It stores mark bundles representing one year.
A mark bundle starts with the year its representing followed by a colon and a line break.
This is followed by 12 lines starting with their number [1-12], a colon and
-31 characters representing the (marked) days.
+(28-31) characters representing the (marked) days.
Every other character then '?' is interpreted as a mark.
-**! WARNING !**
-Because not every month has 31 days you can produce not correct results if you
-set your marks manually. But if you use mark to set your marks fore you this
-should not happen.
-
#### colors content
Every line of the color block is one pair of sign and color separated
@@ -63,6 +58,7 @@ The path to the store file is stored in the environment variable `$__mark_store`
## Example:
+
This is a store generated by the `__mark_new_store` function.
@@ -71,16 +67,16 @@ This is a store generated by the `__mark_new_store` function.
#store#
2016:
1:???????????????????????????????
-2:???????????????????????????????
+2:?????????????????????????????
3:???????????????????????????????
-4:???????????????????????????????
+4:??????????????????????????????
5:???????????????????????????????
-6:???????????????????????????????
+6:??????????????????????????????
7:???????????????????????????????
8:???????????????????????????????
-9:???????????????????????????????
+9:??????????????????????????????
10:???????????????????????????????
-11:???????????????????????????????
+11:??????????????????????????????
12:???????????????????????????????
#end#
```
diff --git a/functions/__mark_new_store.fish b/functions/__mark_new_store.fish
index 5cd411d..06dd2de 100644
--- a/functions/__mark_new_store.fish
+++ b/functions/__mark_new_store.fish
@@ -1,10 +1,24 @@
function __mark_new_store --description "generates new mark store for one year"
+ set year (date "+%Y")
echo "#colors#"
echo "#store#"
- echo (date "+%Y"):
+ echo $year:
for m in (seq 1 12)
echo -n "$m:"
- for d in (seq 1 31)
+ switch $m
+ case 1 3 5 7 8 10 12
+ set days 31
+ case 4 6 9 11
+ set days 30
+ case 2
+ if date -d "$year-02-29" >/dev/null ^/dev/null
+ set days 29
+ else
+ set days 28
+ end
+ end
+
+ for d in (seq 1 $days)
echo -n "?"
end
echo