Journal CLI Part 1 - Planning

In my last post I mentioned I wanted to write a small journal utility for the command line. I have been interested in building in public for a while, but haven't had anytihng to take action on. Well, I do but my brain just wouldn't let me until now. It still probably won't let me but I'm going to try to overcome it.

So requirements ...

Requirements for journal utility

I'm just going to note down some thoughts here, nothing too fleshed out I don't think...

  • should be called globally on the command line
  • automatic date and timestamps when saving a journal entry
  • store in plain text
  • retrieve entries from
    • today
    • yesterday
    • this week
    • last week
    • this month
    • last month
  • add tags for common subjects/projects
    • use '@' to tag subjects
    • use '@p-' to tag projects
  • search for entries with specific tags
  • search for entries with specific tags in certain time frames
  • saving an entry should be as simple as <command> <entry [@tag]>
  • config file to store details for formatting of dates, text location and other things?

Plan

First I'll build out the basic few elements such as taking the input and saving to the storage file, and then retriving based on various date ranges. I'm going to be building this out with Node as I previously mentioned, and I have not had any proper hands on experience with Node so it's going to be a bit of a learning curve.

I know straight away I am going to need something to work with dates better than vanilla JS. Previously I have used MomentJS to work with dates, though I have now seen they suggest not using it and instead working with Day.js. I am currently (putting off) rebuilding this site again, and I've tried out Day.js for it. Pretty much a lift and shift from Moment to Day so it should be nice and simple.

For reading the stdin from the command line I read yesterday about using a Stream to get the data. I'll havea play around with this and see what's what there.

Some ideas for the config file:

  • date formatting
  • storage location for the plain text file
  • different tag formats for normal tag, project, any other 'category' of tag

Summary

So there's the basic plan. I'll likely start this at the weekend this week or something unless my puppy has other plans of keeping me from doing anything other than playing! He is such a cute pup, and an absolute handful!