LoginSignup
2
2

More than 5 years have passed since last update.

今更ながらghq + percolしてみた

Posted at

ghqのお作法でリポジトリ管理するのが便利だ便利だと周りで言われているので、やってみた。

Install ghq

Goが入っていない場合は入れる。

$ brew install go

PATH周りを設定して、ghqを入れて設定

$ export GOPATH=$HOME
$ export PATH=$GOPATH/bin:$PATH
$ go get github.com/motemen/ghq
$ git config --global ghq.root ~/src
$ source ~/.zshrc
$ ghq
NAME:
   ghq - Manage GitHub repository clones

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

VERSION:
   HEAD

AUTHOR:
  motemen - <motemen@gmail.com>

COMMANDS:
   get          Clone/sync with a remote repository
   list         List local repositories
   look         Look into a local repository
   import       Bulk get repositories from a file or stdin
   help, h      Shows a list of commands or help for one command

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

$ ghq list -p
/Users/mikiakira/src/github.com/codegangsta/cli
/Users/mikiakira/src/github.com/daviddengcn/go-colortext
/Users/mikiakira/src/github.com/mitchellh/go-homedir
/Users/mikiakira/src/github.com/motemen/ghq
/Users/mikiakira/src/github.com/motemen/go-colorine

良い感じ。

ghqからのpercol移動

$ vim ~/.zshrc

# ghq
function gcd() {
  if [[ $1 == "" ]]; then
    PERCOL=percol
  else
    PERCOL="percol --query $1"
  fi
  cd $(ghq list --full-path | eval $PERCOL)
}

$ source ~/.zshrc
$ gcd

ついでにgem-srcからのpercol移動

$ git clone https://github.com/amatsuda/gem-src.git $RBENV_ROOT/plugins/gem-src
$ rbenv rehash

$ echo "gemsrc_clone_root: ~/src" >> ~/.gemrc

$ gem i kaminari
$ gcd

良い感じ

参考

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2