Last active
September 3, 2021 22:35
-
-
Save rosvik/db912007369868810ec6fc4496fad717 to your computer and use it in GitHub Desktop.
infinote v0.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Path to infinote git repo | |
| INFIPATH="$HOME/Git/infinote/" | |
| # Path to the note file | |
| INFIFILE="$HOME/Git/infinote/infinote.md" | |
| # Author of automatic git commits | |
| AUTHOR="infinote <[email protected]>" | |
| # Current timestamp formated as "Wed May 12 20:59:43 CEST 2021" | |
| DATE="$(date)" | |
| # Get the number of lines in document for cursor placement | |
| CURSORPOS=$(echo $(wc -l $INFIFILE | awk '{ print $1 }')+3 | bc -iq) | |
| # Add timestamp comment to end of file | |
| echo "---" >> $INFIFILE && | |
| echo "###### $DATE" >> $INFIFILE && | |
| # Open in editor with cursor position | |
| nano +$CURSORPOS $INFIFILE && | |
| #vim +$CURSORPOS $INFIFILE && | |
| #micro $INFIFILE:$CURSORPOS && | |
| #subl --wait $INFIFILE:$CURSORPOS && | |
| #code --wait $INFIFILE:$CURSORPOS && | |
| # Git pull, commit and push | |
| cd $INFIPATH && | |
| git add $INFIFILE && | |
| git commit --author="$AUTHOR" -m "(infinote) Automatic commit $DATE" && | |
| git pull --no-edit && | |
| git push && | |
| cd - # Return to previous directory |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installing:
INFIPATH(line 4) to the path of the folder that was just made.INFIFILE(line 7) to the path of the file you want to make your notes in.Running:
Demo:
infinote.mov