Giter Club home page Giter Club logo

gofu's Introduction

Gofu

Gofu is a multibinary containing several utilities that I use everyday.

What's with the name?

A gofu, according to Wikipedia, is a type of household amulet or talisman, issued by a Shinto shrine, hung in the house for protection.

Alternatively, the name can also be read as "Go-fu".

Installation

$ make && make install

List of applets

prettyprompt

This renders my shell prompt. Among other things, it identifies the current host by name and signature color (in the screenshot below, dark green for Krikkit); highlights path elements inside a Git repo (if any) and path elements that have been deleted; reports the current Git repo status; and reports the exit code of the previous command (if it failed). It also heavily saves space where possible, e.g. if the cwd starts with $GOPATH/src/, that is shortened to repo:. A prefix of $HOME/ is omitted entirely, as is my default user name.

prettyprompt screenshot

rtree

This manages my Git repositories. Borrowing from the convention established by Go's GOPATH, the location of each local repository is defined by its remote URL. For example, this repo here will always be checked out at

$GOPATH/src/github.com/majewsky/gofu

The most common operation with rtree is to get a repository path:

$ rtree get https://github.com/majewsky/gofu
/x/src/github.com/majewsky/gofu

This will automatically clone the repo if it has not been cloned yet. Git URL aliases like these are supported. I use a shell function called cg that means cd to git repository and is based on rtree get:

$ pwd
/home/stefan
$ cg gh:majewsky/gofu
$ pwd
/x/src/github.com/majewsky/gofu

There are a few other subcommands in rtree:

  • rtree drop <URL> deletes the local repo identified by the given remote URL (after asking for confirmation).
  • rtree repos lists the paths (below $GOPATH/src) of all local repos.
  • rtree remotes lists the remote URLs of all local repos.
  • rtree each <COMMAND> executes the given command in each repository.
  • rtree import <PATH> takes a path to a local Git repo, and moves it to the correct place below $GOPATH/src.

Finally, rtree index rebuilds the index file (~/.rtree/index.yaml) that all of these operations use to find repos and remotes. If a repo is checked out, but not yet indexed, the index entry will be added. If the repo for an index entry is missing, the user will be prompted about what to do:

$ rtree index
repository /x/src/github.com/Masterminds/sprig has been deleted
 [r] restore from https://github.com/Masterminds/sprig
 [d] delete from index
 [s] skip

One of the intended usecases is that stuff below $GOPATH/src does not need to be backed up. As long as the index file ~/.rtree/index.yaml is backed up, all repos can be restored in one step with yes r | rtree index.

gofu's People

Contributors

majewsky avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.