github.com/sona-tar/ghs@v0.0.0-20170415134710-bed1b2953748/README.md (about) 1 ghs 2 ====== 3 4 [![Build Status](https://travis-ci.org/sonatard/ghs.svg?branch=master)](https://travis-ci.org/sonatard/ghs) 5 [![Coverage Status](https://coveralls.io/repos/github/sonatard/ghs/badge.svg)](https://coveralls.io/github/sonatard/ghs) 6 [![Go Report Card](https://goreportcard.com/badge/github.com/sonatard/ghs)](https://goreportcard.com/report/github.com/sonatard/ghs) 7 8 `ghs` - command-line utility for searching Github repositoy. 9 10 ![](http://f.st-hatena.com/images/fotolife/s/sona-zip/20141029/20141029212146_original.gif?1414585446) 11 12 Trial 13 =========== 14 [ghs trial page](https://codepicnic.com/consoles/ghs/embed?sidebar=closed&hide=save,show_result,download,options,run,second_terminal,readme) 15 16 17 ghs options 18 =========== 19 20 ```sh 21 [sona ~]$ ghs --help 22 Usage: 23 ghs [OPTION] "QUERY" 24 25 Application Options: 26 -f, --fields= limits what fields are searched. 'name', 'description', or 'readme'. (default: name,description) 27 -k, --fork= Forked repositories included in results. 'true', 'only' or 'false'. 28 -s, --sort= The sort field. 'stars', 'forks', or 'updated'. (default: best match) 29 -o, --order= The sort order. 'asc' or 'desc'. (default: desc) 30 -l, --language= searches repositories based on the language they’re written in. 31 -u, --user= limits searches to a specific user name. 32 -r, --repo= limits searches to a specific repository. 33 -m, --max= limits number of result. range 1-1000 (default: 100) 34 -v, --version print version infomation and exit. 35 -e, --enterprise= search from github enterprise. 36 -t, --token= Github API token to avoid Github API rate limit 37 -h, --help Show this help message 38 39 Github search APIv3 QUERY infomation: 40 https://developer.github.com/v3/search/ 41 https://help.github.com/articles/searching-repositories/ 42 43 Version: 44 ghs 0.0.9 (https://github.com/sonatard/ghs.git) 45 ``` 46 47 Install 48 =========== 49 50 [homebrew](http://brew.sh/index_ja.html), [linuxbrew](http://brew.sh/linuxbrew/) 51 52 ```zsh 53 brew install sonatard/tools/ghs 54 ``` 55 56 for Windows 57 [Releases sonatard/ghs](https://github.com/sonatard/ghs/releases) 58 59 60 Usage 61 =========== 62 63 basic usage. 64 default search target.(name, description and readme) 65 ```zsh 66 ghs "dotfiles" 67 ``` 68 69 You can restrict the search to just the repository name. 70 ```zsh 71 ghs -f name "dotfiles" 72 ``` 73 74 Limits searches to a specific user. 75 ```zsh 76 ghs -f name -u sonatard "dotfiles" 77 sonatard/dotfiles dotfiles 78 ``` 79 80 Github Authentication to avoid Github API rate limit 81 =========== 82 83 Priority of authentication token 84 85 1. Exec `ghs` with `-t` or `--token` option 86 87 ```bash 88 $ ghs -t "....." 89 ``` 90 91 2. `GITHUB_TOKEN` environmental variable 92 ```bash 93 $ export GITHUB_TOKEN="....." 94 ``` 95 96 3. github.token in gitconfig 97 98 ```bash 99 $ git config --global github.token "....." 100 ``` 101 102 Search Github repository and git clone 103 =========== 104 105 with [motemen/ghq](https://github.com/motemen/ghq) and [peco/peco](https://github.com/peco/peco) 106 107 ```sh 108 ghs QUERY | peco | awk '{print $1}' | ghq import 109 ``` 110 111 create zsh function 112 113 ```zsh 114 function gpi () { 115 [ "$#" -eq 0 ] && echo "Usage : gpi QUERY" && return 1 116 ghs "$@" | peco | awk '{print $1}' | ghq import 117 } 118 ``` 119 120 gpi usage 121 122 ```sh 123 gpi dotfiles 124 ``` 125 126 ![](http://f.st-hatena.com/images/fotolife/s/sona-zip/20141029/20141029210952_original.gif?1414584687) 127 128 Remove local repository 129 =========== 130 131 ```zsh 132 function gpr () { 133 ghq list --full-path | peco | xargs rm -ir 134 } 135 ``` 136 137 ```sh 138 gpr 139 ``` 140 141 Search Github repository and open with browser 142 =========== 143 144 ```zsh 145 function gho () { 146 [ "$#" -eq 0 ] && echo "Usage : gho QUERY" && return 1 147 ghs "$@" | peco | awk '{print "https://github.com/"$1}' | xargs open 148 } 149 ``` 150 151 ```sh 152 gho dotfiles 153 ``` 154 155 Contributors 156 =========== 157 158 [kou-m](https://github.com/kou-m) 159 160 161 Author 162 =========== 163 164 [sonatard](https://github.com/sonatard)