/smart-snippets

Simple & intuitive command line utility to store cheat sheet snippets

Primary LanguageShellGNU General Public License v3.0GPL-3.0

smart-snippets a.k.a. Dave

Simple & intuitive command line utility to store cheat sheet snippets


Motivation

People who work with command line prompts (a.k.a terminal) often need to memorise long commands, parameters or configuration values. When it's too much to remember we start digging into command help manuals, or search through cheatsheet artefacts such as online notes or jungles of post-its on our desks, in which cases we are taken out of our workflow and context, generally resulting in a loss of our focus and time.

What is this?

A tool for saving short notes, cheatsheets for terminal commands (or anything organised by text tags). In other words:

A stupid simple command line utility to save single line code snippets.


Quick start:

Installation

   brew tap crocodile/tap
   brew install dave

Save a snippet

   # I'd like to remember what ls -l does
   dave remember ls "ls -l" "Lists directory contents in a long format."

Retrieve a snippet for a tag

(Tag is just a text look up identifier. Can be the name of the command or anything else.)

   # Tell me what the remembered snippets are for ls
   dave tellme ls

In more detail:

Save a snippet

   dave remember [tag] [snippet] [description]

or in short format:

   dave r [tag] [snippet] [description]

or interactively via input prompts:

   dave r # follow the input prompts

Retrieve a snippet for a tag

   dave tellme [tag]

or in short format:

   dave t [tag]

Show me all snippets in a csv file

(This will attempt to open the csv file containing the snippets with the application associated with it on your computer.)

   dave show

or in short format:

   dave s

Help

   dave help

or in short format:

   dave h

Get the version of this tool

   dave version

or in short format:

   dave v

Configurations:

Snippets by default are saved in the dave.csv file located in the $HOME/.smart-snippets hidden folder.

  • Make sure that the $HOME environment variable is set.

  • To change where the $HOME/.smart-snippets/dave.csv file gets saved, move it to the desired location then update the filepath variable in the $HOME/.smart-snippets/dave.conf file.

    Example:

   #!/bin/bash
   filepath=$HOME"/Documents/smart-snippets/dave.csv"   # Changed from filepath=$HOME"/.smart-snippets/dave.csv"