Skip to content

Commit 4693109

Browse files
committed
Scope files to YYYY-MM instead of YYYY-MM-DD
For almost 20 years I manually used YYYY-MM but thought it might be useful to do YYYY-MM-DD since the creation of the files would be automated by the script. It turns out in practice that this wasn't a good idea because the notes become too scattered. Often times you'll be working on something today and writing notes but tomorrow when you resume working, you'll want to reference the notes from yesterday. I tried YYYY-MM-DD for a month and there were about 20 times where I thought "damn it, now I need to look at the previous day's notes". Now this is fixed by just using YYYY-MM to begin with.
1 parent 3efb12d commit 4693109

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Diff for: .travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ install:
1111
- "chmod +x notes"
1212

1313
before_script:
14-
- 'TODAY="$(date +%Y-%m-%d)"'
14+
- 'TODAY="$(date +%Y-%m)"'
1515
- "export NOTES_DIRECTORY=/tmp"
1616
- 'NOTES_FILE_PATH="${NOTES_DIRECTORY}/${TODAY}".txt'
1717

Diff for: README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ within a few seconds.
4444
### Your notes are organized by auto-dated files
4545

4646
Let's say it's December 25th, 2019. If you were to run `notes hello world` it
47-
would create a `2019-12-25.txt` file in your `NOTES_DIRECTORY` (this is
47+
would create a `2019-12.txt` file in your `NOTES_DIRECTORY` (this is
4848
something you can configure). It would then append `hello world` to the end of
4949
the file.
5050

51-
If you run `notes something else that is important` on the same day it would
52-
continue to append to that file.
51+
If you run `notes something else` on the next day it will still append to the
52+
same file and continue appending to that file until the next months hits. For
53+
example, on January 1st 2020 any `notes` commands will append to a
54+
`2020-01.txt` file.
5355

5456
There's other things you can do such as piping input to it, or running the
5557
script without any arguments to open the file in your configured `EDITOR` but
@@ -127,10 +129,8 @@ running one of the above commands. Since everything is text you have a lot of
127129
flexibility!
128130

129131
Also, you have the power of the command line at your finger tips to manipulate
130-
these files however you see fit. For example you can run `cat 2019-12-*.txt >
131-
2019-12.txt` to create a monthly file. Or better yet, if you prefer having
132-
monthly files by default instead of daily files you can just change `date
133-
+%Y-%m-%d` to be `date +%Y-%m` in the notes script for the `NOTES_FILE`.
132+
these files however you see fit. For example you can run `cat 2019-*.txt >
133+
2019.txt` to create a yearly file.
134134

135135
## About the Author
136136

Diff for: notes

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
# $ notes (opens the file in your editor)
88
#
99
# Produces:
10-
# YYYY-MM-DD.txt in your $NOTES_DIRECTORY (this is set below).
10+
# YYYY-MM.txt in your $NOTES_DIRECTORY (this is set below).
1111

1212
set -e
1313

1414
readonly NOTES_DIRECTORY="${NOTES_DIRECTORY:-/d/notes}"
1515
readonly NOTES_EDITOR="${EDITOR}"
1616

17-
readonly NOTES_FILE="$(date +%Y-%m-%d).txt"
17+
readonly NOTES_FILE="$(date +%Y-%m).txt"
1818
readonly NOTES_PATH="${NOTES_DIRECTORY}/${NOTES_FILE}"
1919

2020
if [ ${#} -eq 0 ]; then

0 commit comments

Comments
 (0)