note-mgr-cli
v0.0.4
Published
A CLI for managing notes written in markdown. Designed with publishing and searching in mind.
Downloads
4
Readme
Note-Mgr (aka nom)
nom
is a CLI for managing notes written in markdown. Designed with publishing and searching in mind.
Features
- Organization: A
.index.md
file separates drafts from published notes - making it easier to hop into an unfinished draft..index
is also organized A->Z for both lists. - Draft Generation: Use the interactive command line to quickly populate the frontmatter for new notes or directly via the command options
- Publication: A single command will move a note from draft to published. By default the note's frontmatter will be confirmed prior to publication.
Getting Started
To use the CLI, install it globally:
$ yarn global add note-mgr
# or
$ npm install note-mgr --global
At this point, nom
will be installed. You can confirm by seeing the help menu
$ nom --help
Before using nom
, it must be initialized with nom init
Usage
-i --init
initializenom
-n --new
will create a new note and add it to the.contents
list-u --update
will update the frontmatter for the selected note-r --remove
will prompt for a note to remove-d --date
will interrogate the notes to understand dates of the notes (e.g., publish date)-c --count
will count the notes based on flags provided
Initialization Options
- "-t --target-dir ", "The relative path to the target directory for notes"
% nom init -t path/to/target
If no target directory is passed, you will be prompted to provide one in an interactive session.
New Note Options
To create a new note, at a minimum nom
requires either a title (-t --title
) or to create the note interactively (-i --interactive
).
All options are available for setting declaratively with the following options:
"-c --category <category...>", "The frontmatter for category"
$ nom new -c "note category"
"-d --date ", "The frontmatter for publish"
$ nom new -d 2020-02-20
"-i --interactive", "Interactively publish a note"
$ nom new -i
"-p --publish ", "The frontmatter for publish"
$ nom new -p 2020-02-20
"-t --title <title>", "The frontmatter for the title"
$ nom new --title "the note's title"
"--custom [key:value...]", "Custom frontmatter"
$ nom new --custom "my custom key":"my custom value" --custom "secondKey":"secondValue"
"--private", "Mark the note private"
$ nom new --private
"--tags <tag...>", "The frontmatter for the tags"
$ nom new --tag "tag one" --tag second --tag "a third"
Update Options
The nom update
command begins by finding a note interactively using a fuzzy search of all files within the notes directory. The search is based on the file name, which is tied to the slug of the note.
Nota Bene: If a note is not updated interactively, only the options passed in from the command line will be updated. So, if no options are passed, nothing will get updated, even after the note is selected.
To update a new note, at a minimum nom
requires either a title (-t --title
) or to create the note interactively (-i --interactive
). All options are available for setting declaratively with the following options:
"-c --category <category...>", "The frontmatter for category"
$ nom update -c "note category"
"-d --date ", "The frontmatter for publish"
$ nom update -d 2020-02-20
"-i --interactive", "Interactively publish a note"
$ nom update --interactive
"-p --publish ", "The frontmatter for publish"
$ nom update -p 2020-02-20
"-t --title <title>", "The frontmatter for the title"
$ nom update --title "the note's title"
"--custom [key:value...]", "Custom frontmatter"
$ nom update --custom "my custom key":"my custom value" --custom "secondKey":"secondValue"
"--private", "Mark the note private"
$ nom update --private
"--tag <tag...>", "The frontmatter for the tags"
$ nom update --tag "tag one" --tag second --tag "a third"
Remove Options
nom
has a built in remove
method for deleting notes that are no longer desired. The process is interactive by default.
Nota Bene: Use caution as this is a destructive action. It cannot currently be undone. There's an open issue to make remove a soft delete.
Date Options
The date
command for nom
is intended to identify certain relevant dates quickly.
"-f --first", "Return the earliest published note"
$ nom date --first
"-l --latest", "(Default) Return the latest published note"
$ nom date --latest
"-r --recent", "Return the most recent published note in the past"
$ nom date --recent
WIP "-p --private", "Filters only for private notes" and "-np --no-private", "Filters only for public notes" These options are intended to be used in conjunction with other date filters.
$ nom date --recent --private # or $ nom date --latest --no-private
Count Options
Similar to dates, the count
command in nom
is intended to aid simply querying of your notes. It does not currently support stacking of counters (e.g., nom count --stage --category
will list the counts by stage and category independently).
Local Development
This project uses yarn
to manage dependencies.
yarn build && yarn start
will launch the application locally.
If you want the experience of a globally installed CLI, create a link using yarn link
from the root of the project. When done, clean up the link with yarn unlink
.
Troubleshooting
If you run into a permission denied
error, make sure the script is executable:
zsh: permission denied: note-mgr
$ chmod +x index.js
Commit Log Standards
This project follows SemVer and an adaptation of the conventional commit standard.
Commits are prefixed with the following emoji to indicate their purpose.
| Symbol | code | Interpretation |
| ------ | ------------------------- | ------------------------ |
| ✨ | :sparkles:
| feature |
| 🐛 | :bug:
| fix |
| 💅 | :nail-polish:
| style |
| 🧼 | :soap:
| chore |
| 📝 | :memo:
| docs |
| 🐎 | :racehorse:
| perf |
| 🧪 | :lab:
| test |
| 🏗️ | :building-construction:
| refactor |
| 🧰 | :toolbox:
| tooling / infrastructure |
| 🚀 | :rocket:
| major version bump |
| 📦 | :package:
| minor version bump |