note-cli

command module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 1 Imported by: 0

README

Note

Note is a command-line interface tool for managing notes efficiently. It supports creating, editing, viewing, searching notes, and includes Git integration to keep your notes synchronized and version-controlled. It works amazingly well with note systems like Obsidian.

Features

  • Create and edit notes using your preferred text editor.
  • Automatically save notes in the specified notes directory (NOTES_PATH).
  • Supports searching notes by name and content.
  • Git integration for version control
  • Scratch notes functionality for quick note-taking.
  • Shell autocompletion for commands and file names (supports Bash, Zsh, Fish, and PowerShell).

Installation

  1. Clone the repository:

    git clone https://github.com/rymdlego/note-cli.git
    cd note-cli
    
  2. Build the application:

    go build -o note
    
  3. Move the note binary to your PATH:

    sudo mv note /usr/local/bin/
    

Setup

Before using the note CLI, ensure that the following environment variables are set:

  • NOTES_PATH: Path to the directory where notes are stored.
  • EDITOR: The text editor to use when editing notes (default: vi).
  • NOTES_FILETYPE: The file type for notes (default: md).
  • NOTES_SCRATCHFILE: The scratch file name for quick notes (default: scratch).

For example:

export NOTES_PATH="$HOME/notes"
export EDITOR="nvim"

Usage

General Commands
  1. Edit or Create a Note:

    note edit <name>
    

    This command opens the note for editing. If the note doesn’t exist, it creates a new one with the given name.

    Alias: note insert <name>

  2. View a Note:

    note show <name>
    

    Displays the contents of the note using the configured viewer (NOTES_VIEWER, default is cat).

    Aliases: note view, note display

  3. List Notes:

    note list
    

    List all notes in a tree structure.

    Alias: note ls

  4. Search Notes by Name or Content:

    note find <searchstring>
    

    Finds notes whose names or content contain the search string.

  5. Version:

    note version
    

    Displays the current version of the application.

  6. Git Integration: You can run any Git command inside your notes directory.

    note git <git-command>
    

    Examples:

    • note git status
    • note git add .
    • note git commit -m "Updated notes"

    You can also use shortcuts for common Git commands:

    • note status
    • note add <files>
    • note commit -m "message"
    • note push
    • note pull
Scratch Notes

If you run note without any arguments, it opens a "scratch" note for quick notes:

note

You can also pipe content to the scratch note:

echo "Quick note" | note

Autocompletion

To enable shell autocompletion, use the following command based on your shell:

  • Bash:

    source <(note completion bash)
    
  • Zsh:

    source <(note completion zsh)
    
  • Fish:

    note completion fish | source
    
  • PowerShell:

    note completion powershell | Out-String | Invoke-Expression
    

To permanently enable autocompletion, add the corresponding command to your shell’s configuration file (~/.bashrc, ~/.zshrc, etc.).

License

This project is licensed under the MIT License. See the LICENSE file for details.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL