ghs
- command-line utility for searching Github repositoy.
[sona ~]$ ghs --help
Usage:
ghs [OPTION] "QUERY"
Application Options:
-f, --fields= limits what fields are searched. 'name', 'description', or 'readme'. (default: name,description)
-k, --fork= Forked repositories included in results. 'true', 'only' or 'false'.
-s, --sort= The sort field. 'stars', 'forks', or 'updated'. (default: best match)
-o, --order= The sort order. 'asc' or 'desc'. (default: desc)
-l, --language= searches repositories based on the language they’re written in.
-u, --user= limits searches to a specific user name.
-r, --repo= limits searches to a specific repository.
-m, --max= limits number of result. range 1-1000 (default: 100)
-v, --version print version infomation and exit.
-e, --enterprise= search from github enterprise.
-t, --token= Github API token to avoid Github API rate limit
-h, --help Show this help message
Github search APIv3 QUERY infomation:
https://developer.github.com/v3/search/
https://help.github.com/articles/searching-repositories/
Version:
ghs 0.0.9 (https://github.com/sonatard/ghs.git)
brew install sonatard/tools/ghs
for Windows Releases sonatard/ghs
basic usage. default search target.(name, description and readme)
ghs "dotfiles"
You can restrict the search to just the repository name.
ghs -f name "dotfiles"
Limits searches to a specific user.
ghs -f name -u sonatard "dotfiles"
sonatard/dotfiles dotfiles
Priority of authentication token
- Exec
ghs
with-t
or--token
option
$ ghs -t "....."
GITHUB_TOKEN
environmental variable
$ export GITHUB_TOKEN="....."
- github.token in gitconfig
$ git config --global github.token "....."
with motemen/ghq and peco/peco
ghs QUERY | peco | awk '{print $1}' | ghq import
create zsh function
function gpi () {
[ "$#" -eq 0 ] && echo "Usage : gpi QUERY" && return 1
ghs "$@" | peco | awk '{print $1}' | ghq import
}
gpi usage
gpi dotfiles
function gpr () {
ghq list --full-path | peco | xargs rm -ir
}
gpr
function gho () {
[ "$#" -eq 0 ] && echo "Usage : gho QUERY" && return 1
ghs "$@" | peco | awk '{print "https://github.com/"$1}' | xargs open
}
gho dotfiles