From 4794503f88be47dfeaa3c837523abb9f201c88d1 Mon Sep 17 00:00:00 2001 From: Dakota Chambers Date: Tue, 28 Jul 2020 22:07:03 -0500 Subject: [PATCH 1/2] Add -t/--time timestamp option --- note | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/note b/note index d927a0f..cd2f46e 100755 --- a/note +++ b/note @@ -44,6 +44,7 @@ Arguments: -n | --name Set filename for note. Will be created in \$NOTE_DIR Don't forget an extension like .md -i | --info Print information about a note. + -t | --time Add a timestamp when opening a note. The script loads configuration variables from \${XDG_CONFIG_HOME:-\$HOME/.config}/notekeeper/noterc. @@ -107,6 +108,11 @@ if (($# > 0)); then print_help shift ;; + -t | --time) + printf "[$(date +%T)]\n" >> "$NOTE_DIR/$NOTE_NAME" + shift + open_note + ;; *) printf "Unknown Argument \"$1\"\n" printf "Try \"note --help\" to see usage information.\n" From 01692812f35ed07f1a5165d1cf664e59570c6bd0 Mon Sep 17 00:00:00 2001 From: Dakota Chambers Date: Tue, 28 Jul 2020 22:10:39 -0500 Subject: [PATCH 2/2] Update README with -t usage and update version/changelog --- CHANGELOG.md | 3 +++ README.md | 4 ++++ note | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f9acb1..b914cea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +## v0.5.0 - 28 July 2020 +* Implement -t | --time flag to add a timestamp when opening notes. + ## v0.4.1 - 28 July 2020 * Fix noterc file path when XDG_CONFIG_HOME is not set diff --git a/README.md b/README.md index bf9f0ae..f2396ba 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,10 @@ note file in Vim. * `-h | --help` * Use the `-h` flag to print usage information. +* `-t | --time` + * Use the `-t` flag to add a timestamp when opening a note. + + ## Demo [![asciicast](https://asciinema.org/a/194428.png)](https://asciinema.org/a/194428) diff --git a/note b/note index cd2f46e..6197aca 100755 --- a/note +++ b/note @@ -32,7 +32,7 @@ print_info() { } print_help() { - printf "note - Note Keeper 0.4.1 (28 July 2020) + printf "note - Note Keeper 0.5.0 (28 July 2020) Usage: note [arguments]