-
create repo
-
install https://gitjournal.io/ on phone
-
setup gitjournal on phone
-
clone repo on computer
-
install script alias
$ echo "alias journal=\"python `pwd`/journal.py\"" > ~/.zshrccreate repo
install https://gitjournal.io/ on phone
setup gitjournal on phone
clone repo on computer
install script alias
$ echo "alias journal=\"python `pwd`/journal.py\"" > ~/.zshrc| import readline | |
| import datetime | |
| import os | |
| journal_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "journal") | |
| now = datetime.datetime.now().isoformat().rsplit(".", 1)[0] | |
| readline.set_startup_hook(lambda: readline.insert_text(now)) | |
| try: | |
| date = input("📅 entry date: ") # or raw_input in Python 2 | |
| finally: | |
| readline.set_startup_hook() | |
| lines = [] | |
| while True: | |
| prompt = "" | |
| if not lines: | |
| prompt = "write journal entry, end with double enter:\n" | |
| line = input(prompt) | |
| if len(lines)>0 and line == "": | |
| break | |
| lines.append(line) | |
| template = """--- | |
| created: {date}:00:00+01:00 | |
| modified: {date}:00:00+01:00 | |
| --- | |
| {contents} | |
| """ | |
| with open(os.path.join(journal_dir, f"{date}.md"), "w") as fout: | |
| fout.write(template.format(date=date, contents="\n\n".join(lines))) |