GithubHelp home page GithubHelp logo

baopham / snip Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 124 KB

Command line tool (CLI) to save commands, shortcuts, snippets, etc.

License: MIT License

Go 98.46% Shell 1.54%
snippets cli go commands shortcut

snip's Introduction

snip

Command line interface to save snippets, shortcuts, commands, etc.

Table of Content

Usage

NAME:
   main - Save snippets: commands, texts, emoji, etc.

USAGE:
   main [global options] command [command options] [arguments...]

VERSION:
   3.0.0

COMMANDS:
     add, a       snip add -k="port" -c="lsof -i :{p}" -desc="List processes listening on a particular port"
     search, s    search for snippets: snip search port
     generate, g  generate the snippet by keyword: snip g port p={9000}
     execute, x   execute the snippet by keyword: snip x port p={9000}
     list, l      list all saved snippets: snip list
     remove, r    remove a saved snippet: snip remove port
     help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

Add

snip add -k="port" -c="lsof -i :{p}" -desc="List processes listening on a particular port"

Use {placeholder} for placeholders. See Execute for more on this

List

snip list

you should see:

list

Search

# by substring of keyword
snip search port
# by substring of description
snip search "list process"

you should see:

search

Generate

snip generate port p=9000

This will replace the placeholder {p} with 9000:

generate

snip g port p=9000 -o

For multiple placeholders {p} {a} {b}: snip x port p=9000 a=hello b=world

Execute

snip x port p=9000

This will execute the snippet and print the output to your console.

Or, add --ouput / -o option to save the output of the command to the clipboard.

execute

Remove

snip remove port

To remove a snippet by keyword

Requirements

  • Go ^1.8

Install

go get -u github.com/baopham/snip

Make sure you have $GOPATH set and $GOPATH/bin is in the $PATH, e.g.:

export GOPATH=$HOME/Projects/Go
export PATH=$PATH:/usr/local/opt/go/libexec/bin:$GOPATH/bin

Autocomplete

To have autocomplete enabled, source snip_bash_autocomplete or snip_zsh_autocomplete. E.g. copy one of these (depending on your shell) to /local/path and then add the below to your .bashrc or .zhsrc:

If your shell is zsh, we recommend:
autoload -U compinit && compinit
autoload -U bashcompinit && bashcompinit

source /local/path/snip_bash_autocomplete
# Or
source /local/path/snip_zsh_autocomplete

Test

go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega
ginkgo -r

License

MIT

Author

Bao Pham

snip's People

Contributors

baopham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jeff-blaisdell

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.