Skip to content

Instantly share code, notes, and snippets.

@remy
Last active February 4, 2016 17:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remy/0c0c38266889654a54eb to your computer and use it in GitHub Desktop.
Save remy/0c0c38266889654a54eb to your computer and use it in GitHub Desktop.
gist cli helper

Gist cli helper

First, install the gist command using brew install gist, then add this to your .zshrc (or whatever).

By default this will:

  • create all gists as secret (-p)
  • copy the gist url to the clipboard (-c)
  • open the browser to the gist (-o)

There are three modes for this CLI tool:

  1. gist filename.json will create a new gist from the filename.json with the name filename.json (basically the default usage of the normal gist command)
  2. cat filename.json | gist will create a new gist from STDIN
  3. gist will paste whatever's on the clipboard and create a new gist called paste.txt
function gist() {
local url=""
if [ -t 0 ]; then
if ((! $# )); then
command gist -Pcop -f paste.txt
else
command gist -cop $@
fi
else
command gist -cop $@ < /dev/stdin
fi
}
@kkemple
Copy link

kkemple commented Feb 4, 2016

so useful, thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment