aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/store.md80
-rw-r--r--functions/__mark_new_store.fish13
2 files changed, 93 insertions, 0 deletions
diff --git a/doc/store.md b/doc/store.md
new file mode 100644
index 0000000..eaa99ff
--- /dev/null
+++ b/doc/store.md
@@ -0,0 +1,80 @@
+# Store
+
+The store file is supposed to be the only file used by mark. It is
+used to store the actual data as well as all available and future options.
+
+## Language
+
+The store file is separated in different blocks.
+It is always terminated by "#end#".
+
+### Block
+
++ A Block starts with its name in hashes.
++ Followed by the content of the block.
++ The end of the Block is reached if a new # is found.
+
+Known Blocks are:
+
++ #store# : block to store the actual data
++ #colors# : block to assign colors to mark signs
+
+Example:
+```
+#block#
+foo
+bar
+#otherblock# | #end#
+```
+
+### Block content
+
+The notation of a blocks content is block specific.
+
+#### store content
+
+The store block contains the actual mark data.
+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.
+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
+only by a colon.
+
+## Location
+
+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.
+
+
+```
+#colors#
+#store#
+2016:
+1:???????????????????????????????
+2:???????????????????????????????
+3:???????????????????????????????
+4:???????????????????????????????
+5:???????????????????????????????
+6:???????????????????????????????
+7:???????????????????????????????
+8:???????????????????????????????
+9:???????????????????????????????
+10:???????????????????????????????
+11:???????????????????????????????
+12:???????????????????????????????
+#end#
+```
diff --git a/functions/__mark_new_store.fish b/functions/__mark_new_store.fish
new file mode 100644
index 0000000..5cd411d
--- /dev/null
+++ b/functions/__mark_new_store.fish
@@ -0,0 +1,13 @@
+function __mark_new_store --description "generates new mark store for one year"
+ echo "#colors#"
+ echo "#store#"
+ echo (date "+%Y"):
+ for m in (seq 1 12)
+ echo -n "$m:"
+ for d in (seq 1 31)
+ echo -n "?"
+ end
+ echo
+ end
+ echo "#end#"
+end