Skip to content

AdamSharon/snipository

Repository files navigation

Snipository

Snipository is a Go-based project that provides a way to manage your bash snippets without leaving your terminal.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. you can also install snipository as a ZSH plugin.

Prerequisites

  • Go
  • ZSH Shell

Building

To build a local version of the project, run the following command:

make build-local

This will create a binary named snipository in your current directory.

Installing as a ZSH Plugin

To install snipository as a ZSH plugin, first run the following script from zsh:

ZSH_CUSTOM=$ZSH_CUSTOM ./install_as_plugin.sh

the ZSH_CUSTOM variable is the path to your custom plugins directory, it should be set if you are using oh-my-zsh. it is required here like this because the script runs on a different shell session, and thus, does not have access to the originalZSH_CUSTOM variable.

this will:

  1. create a directory named snipository in your custom plugins directory.
  2. copy the snipository.plugin.zsh file to the newly created directory.
  3. copy the snipository binary to the newly created directory.
  4. adding snipository completion command to your .zshrc
  5. adding export HISTFILE=$HISTFILE to your .zshrc (this is required for the snipository completion command to work properly the HISTFILE is the path for the file that contains the history of your commands, and required as env var that the snipository binary can access)

next, you need to add snipository to your plugins list in your .zshrc file:

plugins=(... snipository)

in order to make auto-completion work, you need to add the following line to your .zshrc file:

source <(snipository completion zsh)

Then, restart your ZSH shell to use snipository.

Usage

before first run, you might want to add the local data file:

mkdir -p ~/.config/snipository && touch ~/.config/snipository/snipository_data.json

help command:

snipository --help

add command:

snipository push-latest <COMMAND NAME>

this will add the latest command from history to the snipository.

get command:

snipository get-snip <COMMAND NAME>

this will copy the command to your clipboard. notice, that the completion in this app works for all the data, so you can use the TAB key to complete the command name, or switch between the commands using the TAB key.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published