0.0.4 • Published 8 years ago

snpt v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

Snpt

Version Build Status npm License Commitizen friendly

A gist powered CLI snippet retriever.

Save a snippet as a gist in GitHub, retrieve the snippet on the command line.

npm.io

Index

##Prerequisites

##Installation

npm install -g snpt

##Usage

###Syncing your snippets

Before you can use Snpt you will need to sync your gists:

snpt sync

If this is the first time you have synced your gists you will be prompted to input a GitHub access token (you will need create this in your GitHub account). This token should be be created with the gist scope enabled.

The sync command will download all of your public and private gists and store them locally for fast retrieval by Snpt.

###Copying a snippet to the clipboard

snpt cp [snippetID]

snippetId is an optional parameter. If a snippetId is not supplied a prompt will be displayed allowing you to choose a snippet to copy to the clipboard.

###Creating a file from a snippet

snpt write [snippetID]

snippetId is an optional parameter. If a snippetId is not supplied a prompt will be displayed allowing you to choose a snippet to create a file from. The created file will be named after the name of the gist file.

###Listing available snippets

snpt ls

This can be useful for searching for a specific snippet - snpt ls | grep <query>.

###Setting a new GitHub access token

snpt token

This command will prompt you to input a new GitHub access token.

###Viewing help for a command

You can view help for a command by passing the -h flag when running a command:

snpt sync -h

###Improve your workflow with fuzzy search

Snpt :heart: fzf

npm.io

snpt ls | fzf | snpt cp

Speed this up by aliasing common usages:

alias cs="snpt ls | fzf | snpt cp" # cs for copy snippet
alias ws="snpt ls | fzf | snpt write" # ws for write snippet

snpt cp and snpt write both accept stdin as an input. If stdin is detected Snpt will try and extract a snippet ID from it. This is how the above fzf usage works.

###Alfred Workflow

The Alfred workflow provides quick access to your snippets from Alfred.

##Bash completion

If you want bash completion for snpt, download the file bash_completion to your preferred bash completion location (i.e ~/bash_completion/snpt) and make sure you source this file in your ~/.bashrc:

source "$HOME/bash_completion/snpt"

##Uninstalling snpt

First run snpt to find the location of Snpt's config file.

Once you have deleted the config file you can uninstall Snpt by running:

npm uninstall -g snpt
0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago