Skip to content

Commit

Permalink
Merge pull request #27 from dcchambers/add-timestamp
Browse files Browse the repository at this point in the history
Add -t | --time flag to add timestamp to note
  • Loading branch information
dcchambers committed Jul 29, 2020
2 parents d335797 + 0169281 commit d5af944
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion note
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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.
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit d5af944

Please sign in to comment.