Skip to content

Dnote CLI

Sung edited this page Jan 28, 2024 · 12 revisions

This document contains instructions for the command line interface.

File locations

  • $HOME/.config/dnote/dnoterc - Dnote configuration
  • $HOME/.local/share/dnote/dnote.db - The SQLite database file where all Dnote data is stored
  • $HOME/.cache/dnote/ - Cache directory used for temporary files.

Dnote respects XDG base directory specification. You can customize the location of all files created by Dnote using the following environment variables.

  • XDG_CONFIG_HOME - Replaces $HOME for the location of Dnote configuration file
  • XDG_DATA_HOME - Replaces $HOME for the location of Dnote database file
  • XDG_CACHE_HOME - Replaces $HOME for the Dnote cache directory.

Configurations

$HOME/.config/dnote/dnoterc contains the following configurations.

  • editor: the command to be executed for text editor. e.g. vim
  • apiEndpoint: the API endpoint without trailing slash. e.g. https://api.getdnote.com
  • enableUpgradeCheck: a boolean indicating whether to automatically check update. (true or false)

Commands

Please see https://github.com/dnote/dnote/blob/master/pkg/cli/COMMANDS.md

Auto-completion

You can auto-complete commands and book names by hitting the tab key. An example is:

$ dnote v j<hit tab>
$ dnote v javascript<hit tab>
$ dnote v js
# ...

Zsh

With oh-my-zsh

If you use oh-my-zsh, you can automatically use auto-completion feature because oh-my-zsh already comes with Dnote plugin by default.

Without oh-my-zsh

If you do not use oh-my-zsh, you can download the auto-complete function from https://github.com/dnote/dnote/blob/b47c792d5fcf610db103ab49c57862e49333e13f/pkg/cli/dnote-completion.zsh, and save it in one of the directories in your $fpath. Then, compinit will include it automatically when you start zsh.

If you don't already have compinit set up, try to place the following in your .zshrc file, and download the dnote auto-complete function as ~/.zsh/completion/_dnote.

fpath=(~/.zsh/completion $fpath)
autoload -U compinit
compinit

Bash

Download the following script: https://github.com/dnote/dnote/blob/b47c792d5fcf610db103ab49c57862e49333e13f/pkg/cli/dnote-completion.bash and save as /etc/bash_completion.d/dnote.