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

textnote

Simple tool for creating and organizing daily notes on the command line

Build Status Coverage Status Go Report Card MIT License

Overview

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.

Key features:

  • Configurable, sectioned note template
  • Easily bring content forward to the next day's note (for those to-dos that didn't quite get done today...)
  • Simple command to consolidate daily notes into monthly archive files
  • Create and open today's note with the default textnote command

All note files are stored locally on the file system in a single directory. Notes can easily be synced to a remote server or cloud service if so desired by ensuring the application directory is remotely synced.

textnote opens notes using the text editor specified by the environment variable $EDITOR and defaults to Vim if the environment variable is not set. See the Editor-Specific Configuration subsection for more details.

Quick Start

  1. Install textnote (see Installation)
  2. Set a single environment variable TEXTNOTE_DIR to specify the directory for textnote's files

That's it, textnote is ready to go!

The directory specified by TEXTNOTE_DIR and the default configuration file will be automatically created the first time textnote is run.

Start writing notes for today with a single command

$ textnote

To first configure textnote before creating notes, run

$ textnote config -p

and then edit the configuration file found at the displayed path.

Installation

textnote can be installed by downloading a prebuilt binary or by the go get command.

Releases

The recommended installation method is downloading the latest released binary. Download the appropriate binary for your operating system from this repository's releases page or via curl:

macOS

$ curl -o textnote -L https://github.com/dkaslovsky/textnote/releases/latest/download/textnote_darwin_amd64

Linux

$ curl -o textnote -L https://github.com/dkaslovsky/textnote/releases/latest/download/textnote_linux_amd64

Windows

> curl.exe -o textnote.exe -L https://github.com/dkaslovsky/textnote/releases/latest/download/textnote_windows_amd64.exe

Installing from source

textnote can also be installed using Go's built-in tooling:

$ go get -u github.com/dkaslovsky/textnote

Build from source by cloning this repository and running go build.

It is recommended to build using Go 1.15.7 or greater to avoid a potential security issue when looking for the desired editor in the $PATH (details).

Usage

textnote is intentionally simple to use and supports two main commands: open for creating/opening notes and archive for consolidating notes into monthly archive files.

open

The open command will open a dated note in an editor, creating it first if it does not exist.

Opening or creating a note for the current day is the default action. Simply run the root command to open or create a note for the current day:

$ textnote

which, using the default configuration and assuming today is 2021-01-24, will create and open an empty note template:

[Sun] 24 Jan 2021

___TODO___



___DONE___



___NOTES___



To open a note for a specific date other than the current day, specify the date with the --date flag:

$ textnote open --date 2020-12-22

where the date format is specified in the configuration.

Alternatively, a note can be opened by passing the number of days prior to the current day using the -d flag. For example,

$ textnote open -d 1

opens yesterday's note.

Sections from previous notes can be copied or moved into a current note. Each section to be copied is specified in a separate -s flag. The previous day's note is used as the source by default and a specific date for a source note can be provided through the --copy flag. For example,

$ textnote open -s TODO -s NOTES

will create today's note with the "TODO" and "NOTES" sections copied from yesterday's note, while

$ textnote open --copy 2021-01-17 -s TODO

creates today's note with the "TODO" section copied from the 2021-01-17 note. Use the -c flag to instead specify the source by the number of days back from the current day. For example,

$ textnote open -c 3 -s TODO

creates today's note with the "TODO" section copied from 3 days ago.

To move instead of copy, add the -x flag to any copy command. For example,

$ textnote open --copy 2021-01-17 -s NOTES -x

moves the "NOTES" section contents from the 2021-01-17 note into the note for today.

The --date and --copy (or -d and -c) flags can be used in combination if such a workflow is desired.

For convenience, the -t flag can be used to open tomorrow's note:

$ textnote open -t

in which case the copy source defaults to today. For example,

$ textnote open -t -s TODO

creates a note for tomorrow with a copy of today's "TODO" section contents.

The flag options are summarized by the command's help:

$ textnote open -h

open or create a note template

Usage:
  textnote open [flags]

Flags:
      --copy string       date of note for copying sections (defaults to yesterday)
  -c, --copy-back uint    number of days back from today for copying from a note (ignored if copy flag is used)
      --date string       date for note to be opened (defaults to today)
  -d, --days-back uint    number of days back from today for opening a note (ignored if date or tomorrow flags are used)
  -x, --delete            delete sections after copy
  -h, --help              help for open
  -s, --section strings   section to copy (defaults to none)
  -t, --tomorrow          specify tomorrow as the date for note to be opened (ignored if date flag is used)

archive

The archive command consolidates all daily notes into month archives, gathering together the contents for each section of a month in chronological order, labeled by the original date. Only notes older than a number of days specified in the configuration are archived.

Running the archive command

$ textnote archive

generates an archive file for every month for which a note exists. For example, an archive of the January 2021 notes, assuming the default configuration, will have the form

ARCHIVE Jan2021

___TODO___
[2021-01-03]
...
[2021-01-04]
...



___DONE___
[2021-01-03]
...
[2021-01-04]
...
[2021-01-06]
...


___NOTES___
[2021-01-06]
...



with ellipses representing the daily notes' contents.

By default, the archive command is non-destructive: it will create archive files and leave all notes in place. To delete the individual note files and retain only the generated archives, run the command with the -x flag:

$ textnote archive -x

This is the intended mode of operation, as it is desirable to "clean up" notes into archives, but must be intentionally enabled with -x for safety. Running with the --dry-run flag prints the file names to be deleted without performing any actions:

$ textnote archive --dry-run

If the archive command is run without the delete flag, archive files are written and the original notes are left in place. To "clean up" the original notes after archives have been generated, rerun the archive command with the -x flag as well as the -n flag to prevent duplicating the archive content:

$ textnote archive -x -n

The flag options are summarized by the command's help:

$ textnote archive -h

consolidate notes into monthly archive files

Usage:
  textnote archive [flags]

Flags:
  -x, --delete     delete individual files after archiving
      --dry-run    print file names to be deleted instead of performing deletes (other flags are ignored)
  -h, --help       help for archive
  -n, --no-write   disable writing archive files (helpful for deleting previously archived files)

Additional Functionality

textnote is designed for simplicity. Because textnote writes files to a single directory on the local filesystem, most functionality outside of the scope described above can be easily accomplished using stanard command line tools (e.g., grep for search).

Configuration

While textnote is intended to be extremely lightweight, it is also designed to be highly configurable. In particular, the template (sections, headers, date formats, and whitespace) for generating notes can be customized as desired. One might wish to configure headers and section titles for markdown compatibility or change date formats to match regional convention.

Configuration is read from the $TEXTNOTE_DIR/.config.yml file. Changes to configuration parameters can be made by updating this file. Individual configuration parameters also can be overridden with environment variables.

Importantly, if textnote's configuration is changed, notes created using a previous configuration might be incompatible with textnote's functionality.

The current configuration can be displayed by running the config command:

$ textnote config

The configuration file path is displayed by using the -p flag:

$ textnote config -p

Defaults

The default configuration file is automatically written the first time textnote is run:

header:
  prefix: ""                              # prefix to attach to header
  suffix: ""                              # suffix to attach to header
  trailingNewlines: 1                     # number of newlines after header
  timeFormat: '[Mon] 02 Jan 2006'         # Golang format for header dates
section:
  prefix: ___                             # prefix to attach to section name
  suffix: ___                             # suffix to attach to section name
  trailingNewlines: 3                     # number of newlines for empty section
  names:                                  # section names
  - TODO
  - DONE
  - NOTES
file:
  ext: txt                                # extension to use for note files
  timeFormat: "2006-01-02"                # Golang format for note file names
  cursorLine: 4                           # line to place cursor when opening a note
archive:
  afterDays: 14                           # number of days after which a note can be archived
  filePrefix: archive-                    # prefix to attach to archive file names
  headerPrefix: 'ARCHIVE '                # prefix to attach to header of archive notes
  headerSuffix: ""                        # suffix to attach to header of archive notes
  sectionContentPrefix: '['               # prefix to attach to section content date
  sectionContentSuffix: ']'               # suffix to attach to section content date
  sectionContentTimeFormat: "2006-01-02"  # Golang format for section content dates
  monthTimeFormat: Jan2006                # Golang format for month archive file and header dates
cli:
  timeFormat: "2006-01-02"                # Golang format for CLI date input

Environment Variable Overrides

Any configuration parameter can be overridden by setting a corresponding environment variable. Note that setting an environment variable does not change the value specified in the configuration file. The full list of environment variables is listed below and is always available by running textnote --help:

  TEXTNOTE_HEADER_PREFIX string
    	prefix to attach to header
  TEXTNOTE_HEADER_SUFFIX string
    	suffix to attach to header
  TEXTNOTE_HEADER_TRAILING_NEWLINES int
    	number of newlines to attach to end of header
  TEXTNOTE_HEADER_TIME_FORMAT string
    	formatting string to form headers from timestamps
  TEXTNOTE_SECTION_PREFIX string
    	prefix to attach to section names
  TEXTNOTE_SECTION_SUFFIX string
    	suffix to attach to section names
  TEXTNOTE_SECTION_TRAILING_NEWLINES int
    	number of newlines to attach to end of each section
  TEXTNOTE_SECTION_NAMES slice
    	section names
  TEXTNOTE_FILE_EXT string
    	extension for all files written
  TEXTNOTE_FILE_TIME_FORMAT string
    	formatting string to form file names from timestamps
  TEXTNOTE_FILE_CURSOR_LINE int
    	line to place cursor when opening
  TEXTNOTE_ARCHIVE_AFTER_DAYS int
    	number of days after which to archive a file
  TEXTNOTE_ARCHIVE_FILE_PREFIX string
    	prefix attached to the file name of all archive files
  TEXTNOTE_ARCHIVE_HEADER_PREFIX string
    	override header prefix for archive files
  TEXTNOTE_ARCHIVE_HEADER_SUFFIX string
    	override header suffix for archive files
  TEXTNOTE_ARCHIVE_SECTION_CONTENT_PREFIX string
    	prefix to attach to section content date
  TEXTNOTE_ARCHIVE_SECTION_CONTENT_SUFFIX string
    	suffix to attach to section content date
  TEXTNOTE_ARCHIVE_SECTION_CONTENT_TIME_FORMAT string
    	formatting string dated section content
  TEXTNOTE_ARCHIVE_MONTH_TIME_FORMAT string
    	formatting string for month archive timestamps
  TEXTNOTE_CLI_TIME_FORMAT string
    	formatting string for timestamp CLI flags

Editor-Specific Configuration

Currently, textnote supports the file.cusorLine and TEXTNOTE_FILE_CURSOR_LINE configuration for the following editors:

  • vi/vim
  • emacs
  • neovim
  • nano

textnote will work with all other editors but will not respect this congifuration parameter.

License

textnote is released under the MIT License. Dependency licenses are available in this repository's CREDITS file.

Comments
  • Enhancement suggestion

    Enhancement suggestion

    I hesitate to ask this but if I take a few days off the -c parameter requires that I remember which day I last made a note for. It would be useful to have it where if there were no value for the c parameter textnote would cycle back and find the last day's note. I have not looked at the code for textnote so don't know if the filename is guaranteed to match the date for that note, but if it is cycling back should work. I really enjoy using textnote. Thank-you for both writing it and making it available.

  • Windows Defender reports the release executable as malicious

    Windows Defender reports the release executable as malicious

    Detected: Trojan:Win32/Fuerboos.B!cl
    Status: Removed
    A threat or app was removed from the device.

    Details: This program is dangerous and executes commands from an attacker.

    Affected items:

    file: C:\Users\me\Downloads\textnote_windows_amd64.exe

    webfile: C:\Users\me\Downloads\textnote_windows_amd64.exe|https://github-releases.githubusercontent.com/319649088/f6846080-6c31-11eb-9984-d3b16f6fee14?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210215T101455Z&X-Amz-Expires=300&X-Amz-Signature=b51b7f4070fd42b78fc24e5192a25a13e0c92d7b5660607d72c3607ee7b16c9a&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=319649088&response-content-disposition=attachment%3B%20filename%3Dtextnote_windows_amd64.exe&response-content-type=application%2Foctet-stream|pid:18472,ProcessStart:132578577092384615

  • Heads-up: Textnote has been packaged for FreeBSD

    Heads-up: Textnote has been packaged for FreeBSD

    Hi there! I would like to let you know that I've recently added textnote to the FreeBSD Ports Collection: https://www.freshports.org/textproc/textnote

    Cheers!

  • Use latest existing note for opening and copying

    Use latest existing note for opening and copying

    • Add capability to find most recently dated ("latest") template file
      • Display message warning if number of template files searched exceeds threshold
      • Add threshold to configuration
    • Add --latest flag to open command to open latest existing file
    • Change copy date default to use latest, fixing a bug where it defaulted to the previous day which might not exist
    • Add tests for open command
    • Add init command to more cleanly create application directories and configuration files
    • Add flags to config command to show active configuration and configuration file
    • Add update subcommand config to overwrite configuration file with active configuration
    • Upgrade to Go 1.16
      • Deprecate use of io/ioutil
      • Update CI configuration
    • Update documentation in README
  • Use defaults for unspecified params in config file

    Use defaults for unspecified params in config file

    • Use defaults for unspecified params in config file so that fields are not required in config file. This will also allow for additive changes to the configuration in the future
    • Display warning on cursor line > 2 for unsupported editors
    • Remove use appdir global variable
  • s3 feature

    s3 feature

    Hello there!

    Thanks for this great tool. It helps me a lot on a daily basis :)

    I was thinking to add s3 support so you could write from anywhere eventually and get the same results. Do you think is worth trying it?

  • Investigate alternatives to coveralls.io and more meaningful test coverage metric

    Investigate alternatives to coveralls.io and more meaningful test coverage metric

    Builds have been failing due to outages with coveralls.io. We should investigate alternative services. Related, the test coverage metric reported for textnote is flawed as it does not discriminate between coverage of meaningful code and code that is not intended to be tested. This is always an issue with reporting test coverage but better approaches to this metric could be possible.

Goodmorning - Daily do-nothing script to ensure daily tasks are reported

goodmorning Daily do-nothing script to ensure daily tasks are accomplished. Usag

Dec 31, 2021
A tiny command-line orientated PKM tool inspired by Taskwarrior and daily logging.

eden eden is a command line tool for creating and manipulating daily log notes. It started life as a series of different bash script that did various

Jan 20, 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
Program to convert plain text to CSV file which can imported into Anki.

Program to convert plain text to CSV file which can imported into Anki. The motivation of this program is to save time by automatically coverting Question and Answer into CSV file which can be imported directly into Anki.

May 22, 2022
A command line tool that builds and (re)starts your web application everytime you save a Go or template fileA command line tool that builds and (re)starts your web application everytime you save a Go or template file

# Fresh Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file. If the web framework yo

Nov 22, 2021
F2 is a cross-platform command-line tool for batch renaming files and directories quickly and safely. Written in Go!
F2 is a cross-platform command-line tool for batch renaming files and directories quickly and safely. Written in Go!

F2 is a cross-platform command-line tool for batch renaming files and directories quickly and safely.

Dec 31, 2022
A twitch focused command line tool for producing, archiving and managing live stream content. Built for Linux.

twinx is a live-streaming command line tool for Linux. It connects streaming services (like Twitch, OBS and YouTube) together via a common title and description.

Oct 17, 2022
e2d is a command-line tool for deploying and managing etcd clusters, both in the cloud or on bare-metal

e2d is a command-line tool for deploying and managing etcd clusters, both in the cloud or on bare-metal. It also includes e2db, an ORM-like abstraction for working with etcd.

Aug 23, 2022
CraftTalk Command Line Tool helps with managing CraftTalk releases on baremetal instances

ctcli - CraftTalk Command Line Tool Commands help Shows help version Shows version init Initializes specified root directory as a ctcli dir. ctcli --r

Jan 20, 2022
MyApps is a universal command line tool for managing manually installed applications.
MyApps is a universal command line tool for managing manually installed applications.

MyApps MyApps is a universal command line tool for managing manually installed applications. Disclaimer I wrote this tool over two long nights while p

Jul 15, 2022
Command Line Tool for managing Apache Kafka

kafkactl A command-line interface for interaction with Apache Kafka | Features command auto-completion for bash, zsh, fish shell including dynamic com

Dec 30, 2022
A command line tool for quickly converting Unix timestamps to human readable form.

stamp A command line tool to quickly format a Unix timestamp in a human-readable form. Installation Go is required to build this software. To just bui

Oct 30, 2021
An open-source GitLab command line tool bringing GitLab's cool features to your command line
An open-source GitLab command line tool bringing GitLab's cool features to your command line

GLab is an open source GitLab CLI tool bringing GitLab to your terminal next to where you are already working with git and your code without switching

Dec 30, 2022
A command line tool to prompt for a value to be included in another command line.

readval is a command line tool which is designed for one specific purpose—to prompt for a value to be included in another command line. readval prints

Dec 22, 2021
A command line http test tool. Maintain the case via git and pure text
A command line http test tool. Maintain the case via git and pure text

httptest A command line http test tool Maintain the api test cases via git and pure text We want to test the APIs via http requests and assert the res

Dec 16, 2022
A client for managing authzed or any API-compatible system from your command line.

zed A client for managing authzed or any API-compatible system from your command line. Installation zed is currently packaged by as a head-only Homebr

Dec 31, 2022
sttr is command line software that allows you to quickly run various transformation operations on the string.
sttr is command line software that allows you to quickly run various transformation operations on the string.

sttr is command line software that allows you to quickly run various transformation operations on the string.

Sep 21, 2021
From the command line, quickly explore data from a CSV file.
From the command line, quickly explore data from a CSV file.

shallow-explore From the command line, quickly explore data from a CSV file. shallow-explore is a Golang backed command-line tool for iterating over c

Nov 10, 2022
Minutes is a CLI tool for synchronizing work logs between multiple time trackers, invoicing, and bookkeeping software to make entrepreneurs' daily work easier.
Minutes is a CLI tool for synchronizing work logs between multiple time trackers, invoicing, and bookkeeping software to make entrepreneurs' daily work easier.

Minutes is a CLI tool for synchronizing work logs between multiple time trackers, invoicing, and bookkeeping software to make entrepreneurs' daily work easier.

Aug 8, 2022