thorrsson / gito

manage your code better!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gito

Tool for managing where your source code lives! Find code and stay organized easier.

Your configurable source path will have directories namespaced by organization and repository ($HOME/src/github.com/r-medina/gito, for example).

Download code

gito get github.com/r-medina/gito # defaults to GOPATH[0]/src/github.com/... or $HOME/src/...

the get command needs a full(ish) name/url - from then on you can refer to repos by a subset of their names (eg “r-medina/gito” or “gito”).

Find out where repo is

gito where r-medina/gito # $HOME/go/src/github.com/r-medina/gito

Can also find code with just repo name

gito where gito # $HOME/go/src/github.com/r-medina/gito

Which you can easily cd into

cd $(gito where gito)

Find repo online

gito url gito         # https://github.com/r-medina/gito
open $(gito url gito) # opens in brownser

Tell gito where a repo lives

gito set r-medina/gito <path> # saves the location information to path
gito where r-medina/gito        # <path>

when a repo’s location is set, only that name can be used, but you can set r-medina/gito and gito to <path> so that both work!

Make alias for repo

gito alias g github.com/mvdan/garble
gito where g # $HOME/go/src/github.com/mvdan/garble
gito alias d dotfiles
gito set dotfiles ~/.dotfiles # $HOME
cd $(gito where d)

Use different workspaces

see config for how to set these up, but

gito -w=work where gh # $HOME/where-i-keep-work-code/src/github.com/github

Usage

   usage: gito [<flags>] <command> [<args> ...]

   Manage code intelligently.

   See http://github.com/r-medina/gito for documentation.

   Flags:
     -w WORKSPACE which workspace to use (defaults to first in config)

   Commands:
     help
	show this message

     get <repo>
	download a repo

     where <repo>
	find out where repo lives

     url [<repo>|.]
	get the url of the repo (for web browsing) - can also pass no argument or "." for current directory

     alias <alias> <to>
	alias a name to something - eg "k8s" -> "github.com/kubernetes/kubernetes"

     set <alias> <location>
	for code living outside your configured path, tell gito where to find it

Example Config

gito cannot do shell expansion for now, so add full paths to the config file.

workspaces:
    - name: personal
      path: "/Users/ricky"
      aliases:
          g: gito
          d: dotfiles
      custom:
          dotfiles: "/Users/ricky/.dotfiles"
    - name: work
      path: "/Users/ricky/gh"
      aliases:
          ghe: super-secret
      custom:
          super-secret: "somewhereElse/theMoneyMaker

Installation

go install -u github.com/r-medina/gito

Useful aliases

Add the following to your shell:

   whence gito > /dev/null || return

   gicd() {
	cd $(gito where $1)
   }

   gpen() {
	open $(gito url $1)
   }

This makes going into your source code directories really easy gcd gito as well as opening the repository in a web browser.

Caveats

  • only works with git
  • only tested with github

About

manage your code better!

License:Apache License 2.0


Languages

Language:Go 99.1%Language:Makefile 0.9%