gist making script
Project description
## gister - make gists!
### examples
* post a public gist on public github:
`cat dog | gister`
* post a secret gist on public github:
`cat dog | gister -s`
* post a public gist on private github deployment:
`cat dog | gister -p`
* post a secret gist on private github deployment:
`cat dog | gister -ps`
* post an anonymous gist on public github
`cat dog | gister -a`
* post an anonymous and secret gist on public github
` cat dog | gister -as`
* post an anonymous gist on private github deployment
`cat dog | gister -ap`
* post an anonymous and secret gist on private github deployment
` cat dog | gister -aps`
### usage
gister [-h] [-p] [-s] [-a] [-v]
make gists!
optional arguments:
-h, --help show this help message and exit
-p, --private put gist on configured enterprise github
-s, --secret gist will be secret (not public)
-a, --anonymous gist will be anonymous
-v, --vim gist came from vim, no prompt/history
### install
fix weird hgtools dependency issue: `pip install hgtools`
clone the repo and `python setup.py install`
### config file - .gister
an example configuration file `.gister` is given for you to use. it will be looked for in `~/.gister`. it supports three values:
* prompt - configure your own prompt (using variables username/hostname/cwd)
* history_file - location of shell history file for command display
* private\_github\_url - if you plan on using `-p/--private` this url needs to be set to the location of your private github deployment
### keyring
i prefer to store my oauth tokens in [keyring](http://pypi.python.org/pypi/keyring) because it's safer than storing it plain text in the .gister file. your python keyring needs to have a section for *github* with a key *token* containing a github oauth token linked to your account. if you use the private github, do the same for *pgithub* and *token*. i added mine like this: [gist](https://gist.github.com/4481060).
### github oauth tokens
here is a [gist](http://gist.github.com/4482201) of the process by which a token is acquired. the returned dict will have a *token* key in it denoting your token. you can also manage your tokens by managing your github account and selecting *Applications*.
### using with vim
I added the following to [my .vimrc](http://github.com/tr3buchet/conf/blob/master/.vimrc) to interact with gister:
" ------- gist making! --------------------------------
fun Gister(...)
let gister_call = "gister -v"
for flag in a:000
let gister_call = gister_call . " " . flag
endfor
let result = system(gister_call, expand("%:t") . "\n" . getreg("\""))
echo result
endfun
" public gist on github from selection or single line
vnoremap <F9> y:call Gister()<cr>
nnoremap <F9> yy:call Gister()<cr>
" secret gist on github from selection or single line
vnoremap <F10> y:call Gister("-s")<cr>
nnoremap <F10> yy:call Gister("-s")<cr>
" public gist on private github from selection or single line
vnoremap <F11> y:call Gister("-p")<cr>
nnoremap <F11> yy:call Gister("-p")<cr>
" secret gist on private github from selection or single line
vnoremap <F12> y:call Gister("-p", "-s")<cr>
nnoremap <F12> yy:call Gister("-p", "-s")<cr>
" ------- end pastie.org ---------------------------
### examples
* post a public gist on public github:
`cat dog | gister`
* post a secret gist on public github:
`cat dog | gister -s`
* post a public gist on private github deployment:
`cat dog | gister -p`
* post a secret gist on private github deployment:
`cat dog | gister -ps`
* post an anonymous gist on public github
`cat dog | gister -a`
* post an anonymous and secret gist on public github
` cat dog | gister -as`
* post an anonymous gist on private github deployment
`cat dog | gister -ap`
* post an anonymous and secret gist on private github deployment
` cat dog | gister -aps`
### usage
gister [-h] [-p] [-s] [-a] [-v]
make gists!
optional arguments:
-h, --help show this help message and exit
-p, --private put gist on configured enterprise github
-s, --secret gist will be secret (not public)
-a, --anonymous gist will be anonymous
-v, --vim gist came from vim, no prompt/history
### install
fix weird hgtools dependency issue: `pip install hgtools`
clone the repo and `python setup.py install`
### config file - .gister
an example configuration file `.gister` is given for you to use. it will be looked for in `~/.gister`. it supports three values:
* prompt - configure your own prompt (using variables username/hostname/cwd)
* history_file - location of shell history file for command display
* private\_github\_url - if you plan on using `-p/--private` this url needs to be set to the location of your private github deployment
### keyring
i prefer to store my oauth tokens in [keyring](http://pypi.python.org/pypi/keyring) because it's safer than storing it plain text in the .gister file. your python keyring needs to have a section for *github* with a key *token* containing a github oauth token linked to your account. if you use the private github, do the same for *pgithub* and *token*. i added mine like this: [gist](https://gist.github.com/4481060).
### github oauth tokens
here is a [gist](http://gist.github.com/4482201) of the process by which a token is acquired. the returned dict will have a *token* key in it denoting your token. you can also manage your tokens by managing your github account and selecting *Applications*.
### using with vim
I added the following to [my .vimrc](http://github.com/tr3buchet/conf/blob/master/.vimrc) to interact with gister:
" ------- gist making! --------------------------------
fun Gister(...)
let gister_call = "gister -v"
for flag in a:000
let gister_call = gister_call . " " . flag
endfor
let result = system(gister_call, expand("%:t") . "\n" . getreg("\""))
echo result
endfun
" public gist on github from selection or single line
vnoremap <F9> y:call Gister()<cr>
nnoremap <F9> yy:call Gister()<cr>
" secret gist on github from selection or single line
vnoremap <F10> y:call Gister("-s")<cr>
nnoremap <F10> yy:call Gister("-s")<cr>
" public gist on private github from selection or single line
vnoremap <F11> y:call Gister("-p")<cr>
nnoremap <F11> yy:call Gister("-p")<cr>
" secret gist on private github from selection or single line
vnoremap <F12> y:call Gister("-p", "-s")<cr>
nnoremap <F12> yy:call Gister("-p", "-s")<cr>
" ------- end pastie.org ---------------------------
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gister-1.0.1.tar.gz
(7.6 kB
view details)
File details
Details for the file gister-1.0.1.tar.gz
.
File metadata
- Download URL: gister-1.0.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7813219b1ed6fcaa067b877de6daf8c91f9d7cd26c545b52fa72304e59321e8f |
|
MD5 | 7171661613e15b023f54b5a4a95f7583 |
|
BLAKE2b-256 | e8071adcef257092f202fbf0f11e65473d7a00c325fc5cdbd7a0a07ec95414e6 |