Giter VIP home page Giter VIP logo

grr's Introduction

grr

grr: git run root - run a file in the git repo root, with tab completion

Installation and Setup

Dependencies

The script needs git and bash

Installation

  $ cp grr ${HOME}/tools/bin
  $ chmod a+x ${HOME}/tools/bin

Setup Tab Completion

Add the following to your .bash_profile

For bash-3.2 (OSX):

if [[ -f ${HOME}/tools/bin/grr ]]; then
    source /dev/stdin <<<"$(cat <(${HOME}/tools/bin/grr --bash-complete))"
fi

For a newer bash:

source <(${HOME}/tools/bin/grr --bash-complete)

Usage

Change directory into some deep directory of a git repo. Type grr then hit <TAB> to get a list of executable files and directories in the git repo root. Pick a command to run, then tab completion reverts to normal argument completion.

 $ cd git-project
 $ ls
 src/    script.sh    tools/
 $ ls tools
 tool1
 $ cd src/some/sub/directory
 $ grr s<TAB>
 script.sh
 $ grr script.sh f<TAB>
 file1.c file2.c
 $ grr script.sh file1.sh
 git-project/script.sh file1.c
 ...
 $ grr tools/<TAB>
 tool1
 $ grr tools/tool1 *.c
 git-projoect/tools/tool1 file1.c file2.c
 ...

grr's People

Contributors

lambdageek avatar

Watchers

 avatar  avatar  avatar

grr's Issues

tab completion of directories should automatically add the '/'

Right now if you tab-complete a directory name

  $ grr dir<TAB>
  directory
  $ grr directory

hitting TAB again at this point doesn't add a slash and doesn't list the files in the directory. The tab completion should be enhanced to understand that if it's completing a directory, it should add a trailing slash and prepare us to complete with another executable file or script name.

tab completion for dry-run mode

There's an (under-documented) -n "dry run" option that just prints out the full name of the command that would have run. But currently if you start writing grr -n tab completion breaks

zsh tab-completion support

I don't use zsh, but other people do and it's the default on OSX now. This script should be usable with zsh

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.