A very simple note-taking CLI you can use from the terminal that uses a SQLite DB to persist, and query, notes.

Note Logger

Summary

A very simple note-taking CLI you can use from the terminal that uses a SQLite DB to persist, and query, notes.

Building/Installing

Ensure that you have Go 1.18 installed locally, and run:

go install

Usage

On the first run, wherever the installed binary is located, a SQLite DB will be created called notes.sqlite.

This stores all the notes logged so far, and allows listing them back in the future.

If you have not compiled the app, but instead use go run main.go note-logger, then the DB will end up being located in a temp folder somewhere (differs by operating system, and Go installation).

Add a Note

note-logger add-note -c "Some new note!"

This will result in some output:

Note added:
2 - Apr 12 16:32:31: Some new note!

You'll get the note's ID, the timestamp when it was created, and the contents.

Delete a Note

note-logger delete-note -i 2

As an argument, you pass in the ID of the note to delete. This will be the output, if successful:

Note deleted.

List Notes

The listing of existing notes takes in two arguments, the beginning, and end for the time period. The values are interpreted using the available English-friendly values compatible with the go-naturaldate package.

For example, here is listing all notes for today:

note-logger list-notes -s "beginning of today" -e "now"

Or even all of the week so far:

note-logger list-notes -s "beginning of week" -e "now"

You'll get output like this:

1 - Apr 12 16:26:19: First note with it all working!
2 - Apr 12 16:37:16: Another note for sample!

Similar to when you create a note, you'll get the note's ID, the timestamp, and the content. You can then retroactively delete notes this way using the delete-note command.

Bash Functions

Executing the commands this way takes time, and perhaps it might be more convenient to type something simple into the terminal. Here are some sample Bash functions that you can add to your .bashrc file that make it easier to do common things:

function note() {
  quoted_note="$@"

  note-logger add-note -c $quoted_note
}

function delnote() {
  note-logger delete-note -i $@
}

function notes_today() {
  note-logger list-notes -s "beginning of today" -e "now"
}

function notes_week() {
  note-logger list-notes -s "beginning of week" -e "now"
}

With this, adding a note can be as simple as typing this in your terminal:

note Here is a new note!

Contributing

Contributions are definitely welcome, so feel free to open a PR adding whatever new functionality you might like.

DB Migrations

Database migrations are handled in the database migration wrapper here: sqlite.go

Adding a migration is as simple as adding an element to the migrations array:

var migrations = []migration{
  {migrationName: "create notes table", migrationQuery: createTableIfNotExistsQuery},
  {migrationName: "add notes created_at index", migrationQuery: createIndexIfNotExistsQuery},
}

Migrations are run within a transaction, and any error results in a rollback. On any execution of the app, it checks the internal pragma setting, and if it is behind, it runs each migration in order to reach the required migration number.

Any migrations that might result in an error should get caught in the integration tests that run, as it starts with a fresh DB every time.

Here's a sample PR that adds a new index on the content column in the notes table: #2

Similar Resources

TScli - a very simple terminal-based client for TSWeb online judge

TScli TScli - a very simple terminal-based client for TSWeb online judge. It supports submitting problems and receiving feedback on them. Installation

Oct 24, 2021

A very simple library for interactively selecting an option on a terminal

A very simple library for interactively selecting an option on a terminal

go-choice A very simple library for interactively selecting an option on a terminal Usage package main import ( "fmt" "github.com/TwiN/go-ch

Dec 30, 2021

A simple tool which you can use to move through your directories from the command line

Fe What is Fe ? Fe is a simple tool which you can use to move through your direc

Jan 1, 2022

bryant's go note and source

These are my notes from when I taught myself Golang. It includes the basic syntax of go language, basic operators, function operations, packages, inte

Oct 17, 2022

textnote is a command line tool for quickly creating and managing daily plain text notes.

textnote is a command line tool for quickly creating and managing daily plain text notes. It is designed for ease of use to encourage the practice of daily, organized note taking. textnote intentionally facilitates only the management (creation, opening, organizing, and consolidated archiving) of notes, following the philosophy that notes are best written in a text editor and not via a CLI.

Jan 2, 2023

Libraries and CLIs for my personal all-in-one productivity system including components like bookmarks, notes, todos, projects, etc.

bntp.go Libraries and CLIs for my personal all-in-one productivity system including components like bookmarks, notes, todos, projects, etc. Neovim int

Sep 13, 2022

Terminal based wordle clone. Uses the amazing charm.sh libraries to render and expose the game over SSH

Terminal based wordle clone. Uses the amazing charm.sh libraries to render and expose the game over SSH

Nov 17, 2022

The Discord terminal client you never knew you wanted.

The Discord terminal client you never knew you wanted.

I AM CLOSING DOWN THE CORDLESS PROJECT Hey, so I know this is somewhat of a bummer, but I got banned because of ToS violation today. This seemed to be

Jan 7, 2023

Gocheat - Golang terminal client for cht.sh that uses charm.sh's bubbletea project

Go Cheat.sh install gotext go get -u golang.org/x/text/cmd/gotext go generate

Jun 3, 2022
A very very simple CLI tool to know the next and previous SpaceX flights.

Rocket A very very simple CLI tool to know the next and previous SpaceX flights. Commands rocket Get the next flight. rocket latest Get the last fligh

Apr 19, 2021
Go-Suit is a very very wacky version of a bash terminal but in go, however with a little twitst

Go-Suit Go-Suit is a very very wacky version of a bash terminal but in go, however with a little twitst languages -> Go-Lang packages Third Party -> g

May 19, 2022
📝 Take notes quickly and expeditiously from terminal
📝 Take notes quickly and expeditiously from terminal

Installation See the last release, where you can find binary files for your ecosystem Curl: curl -sfL https://raw.githubusercontent.com/anonistas/noty

Dec 29, 2022
Tnbassist - A CLI tool for thenewboston blockchain to perform various mundane tasks like taking daily accounts backup

TNB Assist is a CLI (Command Line Interface) tool for thenewboston blockchain to perform various mundane tasks like taking daily accounts backup, computing statistics, etc easier.

Feb 14, 2022
yq lets you read YAML files easily on the terminal. You can find key/values easily
yq lets you read YAML files easily on the terminal. You can find key/values easily

yq yq lets you read YAML files easily on the terminal. You can find key/values easily. Motivation Reading yaml configurations for k8s file becomes ard

Nov 2, 2021
A simple CLI app to take notes daily on markdown file
A simple CLI app to take notes daily on markdown file

A simple CLI app to take notes daily on markdown file

Jul 29, 2022
A password manager as a CLI, where you can use a master password to retrieve a specified password and store it in your clipboard
A password manager as a CLI, where you can use a master password to retrieve a specified password and store it in your clipboard

Password manager Description CLI to store and retrieve passwords. The retrieved password will be stored on your clipboard! Usage 1.Start with Go go ru

Dec 16, 2021
A CLI tool that you can use create regular backups of your Notion.so Pages.

notion-offliner A CLI tool that you can use create regular backups of your Notion.so Pages. Perfect for disaster scenarios and offline usage. MacOS an

Jan 3, 2023
A very basic cli keyring tool to use accross various OS.

A very basic cli keyring tool to use accross various OS.

Dec 14, 2022
A Simple Note API For Golang

Simple Note API Start up run go run main.go Endpoints GET localhost:8080/notes -> gets all of the notes in the database POST localhost:808/note -> cre

Dec 15, 2021