Coder Social home page Coder Social logo

gr's Introduction

Features

  • Tag all the things! gr @work foo will run the command foo in all the paths tagged @work.
  • Auto-discovery of git repositories for easy setup and tag management.
  • gr does not reinvent any git operations: instead, it passes through and runs any unknown commands. All your git-fu will still work! e.g. gr @work git fetch is the same as running git fetch in each all the paths tagged @work.
  • Built-in commands for common pain points:
    • status for one-line summaries of repos (modified, behind/ahead, tags)
  • Extensible via plugins and middleware: REST API/Connect-style request handlers (function(req, res, next) { ... }

Changelog

  • Looking for more committers! Let me know if you're interested; gr currently meets my fairly limited needs but I know it can become even more useful given a larger core team and/or a stronger vision around how it can support usage in a team working on multiple repos.
  • 0.5.5: Submodule directory detection fixes, thanks @bimlas! Better behavior when the EDITOR environment variable is not set, thanks @petercoulton!
  • 0.5.4: Added gr export and gr import for sharing .grconfig, thanks @timja-kainos! Added current branch to status, thanks @n1ywb!
  • 0.5.3: minor improvements to internals, thanks @timja-kainos!
  • 0.5.2: gr now handles git submodules better, thanks @cojomojo! gr also prints out tags with newlines which makes for a more readable output, thanks @nwinkler!
  • 0.5.1: gr discover now handles paths outside the home directory as expected, thanks @farmerchris!
  • 0.5.0: gr discover is now an alias for gr tag discover; gr discover now accepts path arguments, shows progress during a scan and only scans five levels deep by default. Thanks @coderjoe for the patches!
  • 0.4.1: gr status now only invokes git once per directory, thanks @coderjoe!
  • 0.4.0: Added several usability improvements and bug fixes, courtesy of @nichtich (better handling of missing directories, support for simple paths). Added a fix that improves errors related to directory permissions, courtesy of @pnxs.
  • 0.3.0: Switched from #foo to @foo for tags; while the #foo syntax looks cool, most shells will treat it as a comment unless the tag is surrounded by quotes. Looking back at the design, I'd rather go for usability over pretty looking commands. Updated the documentation to match this change.

Example

gr works by tagging directories with tags:

gr +@work ~/mnt/gluejs ~/mnt/microee

After this, you can run any commands on the tagged directories simply by prefixing them with gr @work. For example:

gr @work status

Outputs (actual output is colorized):

~/mnt/gluejs           2 modified [ahead 2]      @work
~/mnt/microee          Clean                     @work

E.g. path, modified, ahead/behind remote, tags. Alternatively, you can use plain git commands for a more verbose report:

gr @work git status -sb

Outputs:

in ~/mnt/gluejs

## glue2
 M lib/runner/package-commonjs/index.js
 M index.js

in ~/mnt/microee

## master

gr doesn't do any command rewriting, or introduce any new commands - I like git as it is.

Getting started

First, install Node.js. Node.js adds the node and the npm command. On Ubuntu you need the nodejs-legacy package.

Next, to install gr (the name was already taken on npm):

npm install -g git-run

You may need to prefix this with sudo.

Setting up tags

Use the auto-discovery feature to set up tags quickly:

gr tag discover

By default auto-discovery searches all paths under your home directory. gr discover is also an alias for gr tag discover (since v0.5.0).

Note that discover only scans up to five levels deep by default (since v0.5.0); if you need to scan even deeper in your path tree you should just pass in an explicit set of starting points to gr tag discover.

If you'd prefer, you can specify a directory under which auto-discovery should search (since in v0.5.0):

gr tag discover /mnt/external/projects

Once auto-discovery completes, it will generate a list, and open it in your default console editor.

It will look like this:

# Found the following directories with `.git` directories.
#
# Please add any tags you want by adding one or more `@tag`
# entries after the path name.
# For example:
#   ~/foo @work @play
# will tag ~/foo with @work and @play.
#
~/foo
~/bar/baz

Add tags after each path, save the file, and exit.

Your tags are now set up!

Verify with gr status or gr tag list. Use gr @work status or gr @work ls -lah to see how commands are executed. (status is a built-in command; ls -lah is not, so it is run in each of the paths.)

You can run auto-discovery multiple times. It makes tag-related bulk changes quite easy.

Tab completion

To add tab completion:

  • open your ~/.zshrc or ~/.bashrc (~/.bash_profile on OS X)
  • add the line . <(gr completion) at the end of the file
  • then, to apply this change to your current session, run source ~/.zshrc (or source ~/.bashrc or source ~/bash_profile)

Now, when you type gr <tab>, you'll see the list tags you've created. If you notice any bugs, let me know via an issue.

How I use gr

Some examples:

COMMAND TASK
gr @work git fetch and then gr @work status Update all my work repos. This fetches the newest information from the remote, and then prints a one-line-at-a-time summary.
gr @work git diff or gr @work git diff --cached See diffs
gr @work jshint . --exclude=**/node_modules Run jshint
gr @write make Rebuild all my writing via make
gr @work npm ls List install npm modules
gr @work git --no-pager log --decorate --graph --oneline -n 3 Print a graph-like log

Of course, I don't actually type these out; I'm using zsh aliases instead. grd is for diff, grdc is for diff --cached; grl is for the log. For example, in .zshrc:

alias grs="gr status"
alias grl="gr git --no-pager log --decorate --graph --oneline -n 3"

You can set up similar aliases for bash; Google is your friend here.

Usage

Usage:

gr <options> <targets> <cmd>

Options

Currently, there is just one option: --json, which switched to a machine-readable output and is used for integration tests.

Targets

Targets can be paths or tags. For example:

gr ~/foo ~/bar status
gr @work ls -lah
  • Path targets should be directories.
  • Tags refer to sets of directories. They managed using the tag built-in.

If no targets are given, then all tagged paths are used. For example, gr status will report the status of all repositories.

Tagging

Short form:

@tag            List directories associated with "tag"
@tag <cmd>      Run a command in the directories associated with "tag"
-t <tag> <cmd>  Run a command in the directories associated with "tag"
+@tag           Add a tag to the current directory
-@tag           Remove a tag from the current directory
+@tag <path>    Add a tag to <path>
-@tag <path>    Remove a tag from <path>

Long form:

tag add <tag>   Alternative to +@tag
tag rm <tag>    Alternative to -@tag
tag add <t> <p> Alternative to +@tag <path>
tag rm <t> <p>  Alternative to -@tag <path>
tag list        List all tags (default action)
tag discover    Auto-discover git paths under ~/

Example:

gr +@work ~/bar

Internally, the tags are stored in the config file ~/.grconfig.json. For example, the tag @books for the path /home/m/mnt/css-book would be stored as:

{
 "tags": {
  "books": [
    "/home/m/mnt/css-book"
  ]
}

For some use cases, it may be easier to just edit this file rather than use the commands tag add and tag rm.

Commands

The command can be either one of the built-in commands, or a shell command. For example:

gr @work status
gr ~/foo ~/bar ls -lah

To explicitly set the command, use --:

gr ~/foo -- ~/bar.sh
gr @work -- git remote -v

Tags can also be specified more explicitly. For example gr -t work -t play is the same as gr @work @play.

Built-in commands:

gr tag ..
  add <t>         Add a tag to the current directory
  rm <t>          Remove a tag from the current directory
  add <t> <path>  Add a tag to <path>
  rm <t> <path>   Remove a tag from <path>

gr tag discover <paths> Auto-discover git paths under  the list of <paths>
                       (If omitted, <paths> defaults to ~/)

gr tag list         List all known repositories and their tags

gr list        List all known repositories and their tags

gr status       Displays the (git) status of the selected directories.
gr status -v    Runs "git status -sb" for a more verbose status.

gr config ..
  get <k>       Get a config key (can also be a path, e.g. "tags.foo")
  set <k> <v>   Set a config key (overwrites existing value)
  add <k> <v>   Add a value to a config key (appends rather than overwriting)
  rm <k> <v>    Remove a value from a config key (if it exists)
  list          List all configuration (default action)

gr help        Show this help
gr version     Version info

Plugins

TODO:

  • bootstrap: bootstraps a set of repositories from a config file.

Installing plugins

Generally speaking, you need to do two things:

  1. install the plugin globally via npm: npm install -g foo
  2. configure gr to use the plugin: gr config add plugins foo

The new commands should now be available.

Writing plugins

Plugins are functions which are invoked once for each repository path specified by the user. This makes it easier to write plugins, since they do not need to handle executing against multiple repository paths explicitly.

Plugins are treated a bit like a REST API: they are defined as "routes" on the gr object.

Each plugin consists of an index file which is loaded when gr is started, and which should add new "routes":

module.exports = function(gr) {
  // set up new commands on the gr object
  gr.use(['foo', 'help'], function(req, res, next) {
    console.log('Hello world');
    req.exit(); // stop processing
  });
  gr.use('foo', function(req, res, next) {
    console.log(req.argv, req.path);
    req.done(); // can be called multiple times
  });
};

Of course, req and res in the handlers are not HTTP requests, but rather objects representing the target directory (a regular object) and process.stdout.

Each "route" is called multiple times, each with one path. Thus, assuming @work matches two paths, gr @work status is translated into multiple indvidual function calls; one for each directory/repository tagged @work.

  status({ path: '/home/m/foo', argv: ... }, process.stdout, next);
  status({ path: '/home/m/bar', argv: ... }, process.stdout, next);

There are three ways to stop processing:

  1. Call res.done(). This means that the command should be called again for the next path. This is useful for processing commands that target directories.
  2. Call res.exit(). This means that the command is complete, and gr should exit. For example, we don't want to show a help text multiple times if the user calls gr @work help.
  3. Call next. This means that the current handler does not want to handle the current request. Similar to how Connect works, this is mostly used for writing middleware or falling back on a different action.

The req object describes the current request.

  • req.argv: the command line arguments passed to the command, excluding ones that have already matched. For example: given app.use(['foo', 'add'], ...) and gr foo add bar, argv = [ 'bar' ].
  • req.config: the configuration object used by gr; allows you to read and write configuration values (see the code for details).
  • req.path: the full path to the repository directory for this call
  • req.gr: the instance of gr (see index.js)
  • req.format: The desired output format, either human or json.

The res object controls

  • res.done: Call this function when you have completed processing the task.

The next function is used if you decide not to handle the current request. Calling next will make the next matching request handler run. If you encounter an error, call next(err) to output the error.

Writing middleware

Middleware are functions that extract additional metadata.

  • req.git.remotes: TODO - a hash of remotes (for example: { origin: 'git...'}). Extracted via the git middleware.

A list of plugin ideas

Here are some plugin ideas:

  • extend auto-discovery beyond git
  • run tests
  • run jshint / gjslint (only modified?)
  • do npm / package.json linting
  • generate docs
  • fetch and report status as one action
  • report npm versions (and whether the version of the package on npm is up to date)
  • generate a changelog (between tagged versions)
  • check that npm modules are up to date
  • run npm link on all modules
  • generate a list of authors
  • generate a list of licences
  • xargs compatibility
  • Ability to confirm each command (to make it possible to skip)
  • Ability expose other statuses (e.g., npm outdated)

Make your plugin searchable

If you write a plugin, make sure to add the gr keyword to (in package.json). This makes it easy to find plugins by searching npm by tag.

Also, file a PR against this README if you want to have your plugin listed here.

Status matching idea

(This is just a random idea) Using "meta-tags" to target commands based on git ls-files.

  • clean: Clean working directory - in other words, no tracked files are modified; no untracked files exist.
  • untracked: Has files that are not tracked (but that have not been added to tracking)
  • modified: Has files that are tracked and modified (but that have not been staged)
  • deleted: Has files that are tracked and deleted
  • staged: Has files that are staged for commit (but that have not been committed)
  • unmerged: Has files that have not been merged
  • unclean: Does not have a clean working directory.

For example: gr @clean git fetch

Inspired by

gr's People

Contributors

balos1 avatar bimlas avatar cackovic avatar clauswilke avatar coderjoe avatar farmerchris avatar jlafourc avatar michaek avatar mixu avatar nichtich avatar nwinkler avatar petercoulton avatar pnxs avatar stigkj avatar timja avatar zearin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gr's Issues

Doesn't work on submodules.

If foo/ is a git repo containing a submodule bar/, and I try to execute 'status' on bar, I get: "Missing .git directory". Any chance this can generalized to work for submodules?

Feature request - Export & import of repo collections

Hey @mixu , thank for the great gr, it is very useful!

I would really love to see an export & import feature so that developers can share a collection of repos.

I imagine it could work something like this:

  1. Developer A has a folder full of repos in his ~/dev/company folder.
  2. He runs gr export ~/dev/company.
  3. gr creates a list of relative folder names, corresponding git repo URIs, and corresponding tags for each of the subfolders.
  4. Developer A sends that file (maybe JSON named gr-export.json?) to Developer B.
  5. Developer B creates a new folder ~/company-dev.
  6. Developer B runs the command gr import gr-export.json ~/company-dev.
  7. gr now creates each of the subfolders in this new location.
  8. Inside of each folder, gr clones the corresponding repo.
  9. gr tags the folders with the same tags they had at Developer A's location.

So, this lets developers share a completely configured folder hierarchy. To onboard a new developer, he simply needs to gr import the latest company export.

Support missing directories

A missing directory is reported as Clean, followed by an error message. This should be changed to status Missing.

gr should further support cloning a missing directory listed in .grconfig.json, e.g. to clone all repositories tagged as work unless they already exist:

gr @work clone

`gr discover` error

Ran in my home directory:

$ gr discover

in ./

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: spawn discover ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1046:32)
    at child_process.js:1137:20
    at process._tickCallback (node.js:355:11)
    at Function.Module.runMain (module.js:503:11)
    at startup (node.js:129:16)
    at node.js:814:3

My info:

  • OS X 10.9 (Mavericks)
  • node --version: v0.12.0
  • npm --version: 2.6.0
  • git --version: git version 2.3.0

"gr status" raises error "./ Missing .git directory."

I've just installed gr and initialized my list of repositories via

gr tag discover .

When the editor opened I quit without adding any tags (I currently don't need any since I always want to target all repos at the moment). gr then told me that I could use gr status, however:

$ gr tag discover .
[gr] 421/421 Scanning venv/local/lib/python2.7/* for .git directories (depth 5)
Tags updated. Run `gr status` or `gr tag list` to see the current state.
$ gr status
./ Missing .git directory

If I pass a path then it works:

gr repo1 status
/path/to/repo1  1 modified 

This is on 0.5.1.

Conditionally execute based on current branch

In large projects with many repositories there are times when you need to run commands on a certain set of repositories (facilitated by the tags functionally) but additionally only if that repository is on a specific branch.

In my current work flow I ended up with a branch that didn't have its upstream set. I had a tag for the current set of repositories, but one specific branch didn't have its upstream set. Through tags, I could add the tag to the repositories and then run my command, but at that point I could just run the command manually as I visit each repository.

In situations like these, it would be nice to have a way to filter by tag and by branch. It could look something similar to:

gr -t someTag -b someBranch -- git branch --set-upstream-to=origin/someBranch someBranch

Can't call `git commit -m "..."`

Fails to call across all repos

$ gr git commit -m "Fixes mocha test selector"

in /foo/bar

error: pathspec 'mocha' did not match any file(s) known to git.
error: pathspec 'selector' did not match any file(s) known to git.

spawn-task: "git commit -m Fixes mocha test selector" exited with nonzero exit code: 1

gr @tag status makes a redundant call to git status

The status command currently executes two child processes to fetch the status of a repository. I believe this could be reduced to one call to git status --branch --porcelain.

I'll prepare a pull request for your review, my only worry is that I can't seem to run the full test suite on the machine I have access to at the moment.

Could not specify a string for a commit message

Hi Rolland,
I did not manage to use gr to commit some changes using git.
It seems it does not interpret the double quotes (") or single quotes (') properly.
here is an example of a command that fails

gr #pub git commit -m "README.md update to fix some tabulations"

in /Applications/java/talend/git/studio-full-master/tbd-studio-se

error: pathspec 'update' did not match any file(s) known to git.
error: pathspec 'to' did not match any file(s) known to git.
error: pathspec 'fix' did not match any file(s) known to git.
error: pathspec 'some' did not match any file(s) known to git.
error: pathspec 'tabulations' did not match any file(s) known to git.

spawn-task: "git commit -m README.md update to fix some tabulations" exited with nonzero exit code: 1

gr status doesn't spot unpushed work in branches

The gr status command currently only looks for changes in the currently checked out branch. It misses un-pushed commits in branches that aren't checked out. This is a problem for repositories where I might be working on multiple branches at a time, make a commit on one branch, and checkout another branch without pushing. The branch might not even be tracking any remote branches. If that branch is stuck on my laptop or something while it's asleep, I could easily misplace a lot of work.

The scenario is easy to reproduce:

$ cd ~/code/myRepo
$ git checkout -b test master
Switched to a new branch 'test'
$ echo "foo" > bar
$ git add bar && git commit -m "test of unpushed work"
[test 95ab954] test of unpushed work
 1 file changed, 1 insertion(+)
 create mode 100644 bar
$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
$ gr status
~/code/myRepo    Clean

If I'm to trust the output of gr status, that branch is as good as lost.

Fortunately, git has built in functionality to search for this type of thing. The command is rather long though:

$ gr git --no-pager log --branches --not --remotes --simplify-by-decoration --decorate --oneline
in ~/code/myRepo

95ab954 (test) test of unpushed work

I found this command with a quick Google search at this thread on Stackoverflow:
http://stackoverflow.com/questions/15134438/git-show-unpushed-work

This functionality is rather important to me, so I might start working on a patch if I can find the time. Another thing to add would be checking stashed changes or un-pushed submodule changes. The idea is that gr status should pick up on ANY work I haven't uploaded somewhere, so it doesn't come back to bite me later.

gr discover output file location?

After I run "gr discover ~/git-repos" , I am prompted with a list of repos. I add the appropriate tag @xyz. The default location of the file is "/tmp/gr-repos-tmp.txt". How are these tags applied to the repo. git discover doesn't automatically update my .grconfig.json file. Can I specify the location of gr-repos-tmp.txt in my .grconfig.json ?

Bash autocompletion

Bash autocompletion for gr commands. Also autocompletion for any commands passed (whether git or anything else).

Unhandled 'error' event

When I run gr discover or . <(gr completion), I get this error. I'm on Mac OS X, and have the same error across two computers.

Otherwise gr works excellently (thank you for the superb tool!)

MacBook-Pro:workspace mr$ gr discover

in ./

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: spawn discover ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
    at child_process.js:1144:20
    at process._tickCallback (node.js:355:11)
    at Function.Module.runMain (module.js:503:11)
    at startup (node.js:129:16)
    at node.js:814:3

gr discovers chokes on missing permissions

If you have a symbolic link to some directory containing directories which you do not have access to in your home directory, discover doesn't skip them, it fails.

lucas@srv2 test $ gr tag discover

fs.js:665
  return binding.readdir(pathModule._makeLong(path));
                 ^
Error: EACCES, permission denied '/home/lucas/homes/Concoct/NewMock2/'
    at Object.fs.readdirSync (fs.js:665:18)
    at find (/home/lucas/programs/node/lib/node_modules/git-run/lib/find-by-subdir.js:40:18)
    at /home/lucas/programs/node/lib/node_modules/git-run/lib/find-by-subdir.js:63:14
    at Array.map (native)
    at find (/home/lucas/programs/node/lib/node_modules/git-run/lib/find-by-subdir.js:62:8)
    at /home/lucas/programs/node/lib/node_modules/git-run/lib/find-by-subdir.js:63:14
    at Array.map (native)
    at find (/home/lucas/programs/node/lib/node_modules/git-run/lib/find-by-subdir.js:62:8)
    at /home/lucas/programs/node/lib/node_modules/git-run/lib/find-by-subdir.js:63:14
    at Array.map (native)
lucas@srv2 test $

Which tag is default?

Not clear from documentation which tag is default when executing simply "gr status" instead of e.g. "gr @work status".

Make discover show progress

I typed discover a while ago, and I'm still waiting.
Is it still searching? Is it stuck? Did it crash?
I wish there was some progress indication just to see that it's still working...

Feature Request: @tag && @tag

Right now there doesn't seem to be a way to target only repos that have all of specified tags, instead of one or more. This would be great if it were possible.

nodejs instead of node

On Ubuntu 14.04, gr doesn't work out of the box because the crash-bang line uses node instead of nodejs.
#!/usr/bin/env node should be #!/usr/bin/env nodejs

The workaround is to install the nodejs-legacy package.

I don't know how it is with other distro.

Allow to display command outputs inline

Currently when executing a command associated outputs are displayed per project in columns.

For short outputs it would be convenient to have a line oriented output like gr status does.

e.g.

gr --inline git symbolic-ref --short HEAD

project1                 some-branch
project2                 develop

Remove json format

Support of the --json output format spoils the source code at many places adding complexity, bad design, and bugs. I'd rather remove the feature. Otherwise gr needs a major code refactoring to abstract from output formats, making it even more complex.

Manage common files across repos

I'm looking for a tool that will keep common files across repos in sync. Files like gitignore or CI settings is what I'm thinking about.

The bootstrap idea you had might cover it but I just wanted to make sure my need is coverable by this tool or is some other solution should be used.

gr ignores aliases set in the current context

Hi,

Thanks for gr, what a cool little tool! I have a lot of aliases, like alias st=git status, and I'd like it if gr respected those aliases so I could do things like gr #all st and gr #some st without having to define an alias for every tag I may want to use.

I don't know how gr works internally, but I'm guessing it launches subprocesses for each path. I think the solution may be as simple as passing the env into all of the subprocesses that gr launches.

avoid @tag and use just word or tag1/tag2/tag3

Couple of issues here:

  • it's nice in configs, listing, during the discover (all the visual) but for writing it each time point less.
  • fish shell, while defining an alias by function, cant send "@" as that way is used by fish to "some" array object.

why not just:

gr work git status
gr work/github git status     # and treat it as $1.split('/') ?

Regarding aliases for shell, ie the fish shell example, one would like to use sth like following code to address command on specific set of repositories:

function grs
   # you cant pass @ without \ or using ''
   gr @$argv[1..-1] git status

however, if "gr" would work only with the set of repositories under current $PWD this would not be almost necessary.

gr list hasn't printed out the tags

In the docs it mentions

gr list List all known repositories and their tags

I'm getting a list of the repository directories but not their tags.
Although I do only have 1 tag so perhaps that's it.

Expand tilde for $HOME in grconfig.json

I have multiples machines and I want to share a grconfig.json with all of them as I have a configs git repository. Some of them have different $HOME directories so the full paths required by grconfig.json is unfortunately a bit of a hangup.

I would love to be able to use tilde for $HOME in grconfig.json. Is there any workaround currently? Otherwise, I'm going to have to write a script to generate grconfig.json files for each machine.

Love gr!

Erik

gr tag discover does not recurse directories

Hi,

Just tried gr tag discover in my home folder and got this result:

[gr] 1/1 Scanning /Users/mp/* for .git directories (depth 1)
Tags updated. Run `gr status` or `gr tag list` to see the current state.

It seems that gr tag discover does not recurse in subfolders. Should I pass a specific argument to set the recursion depth ?

For information:

$ gr --version
0.5.1

$ git --version
git version 2.7.2

 $ sw_vers -productVersion
10.11.3

Thanks,

gr discover <path> should expand discovered repos to full paths

Running discovery with a path, such gr discover . creates a config file with relative paths in it. This is not useful unless gr is run in the same directory. The program should convert the path to full paths starting with / or ~ automatically so that discovered repos can be referenced from anywhere.

Example:

> gr discover .
# Found the following directories with `.git` directories.
...
play/a
play/b

Better would be:

> gr discover .
# Found the following directories with `.git` directories.
...
~/src/play/a
~/src/play/b

A workaround is to use gr discover pwd``.

This behavior was reproduced on gr version 0.5.0 and OS X 10.11.3.

Add parallel tasks

Is there a chance you could add the feature of tasks run in parallel?
A parallel run of a git pull would've been a significant difference to our daily workflow.

Introduce notion of prerequisites for commands

For example, running git requires that the directory has a .git subdirectory, and running make requires that a Makefile exists. This would clean up some of those ugly errors when trying to run a command a set of tagged folders, some of which do not meet the prereqs for the command.

use of # is awkward for bash users

Hello Mikito,

Once I realized I had to escape my hashes (or use the -t option), gr has been working fairly well and is proving to be useful.

I'm impressed with the docs you have written at http://mixu.net/gr/ however, it took me a while to realize what I was doing wrong (bash treating a # as a comment, unlike zsh). Seeing as there's a lot of us bash users, would it be possible to also support '@' as a tagging character? Alternatively could you make a big red warning on near the top of your docs to point out the -t option for us bash users. I was immediately stumped when my commands failed to do what the docs stated they should do.

Cheers,
Alex.

PS: it's impossible to find your email on your webpage.

Support tab-completion for commands

gr <tab> works but I expected gr git l<tab> to return the completion of git l<tab>.

gr should delegate tab completion to other commands such as git.

"gr" collides with an alias in the zsh git plugin

Firstly - this is a great looking project which I'm excited to try out.

One initial stumbling block I've encountered is that the gr command collides with the gr alias in the zsh git plugin.

Obviously if you don't use this plugin you don't really care, but at my company at least it's widely used.

Would be cool if gr shipped with a couple of aliases (gitrun, git-run, grun maybe?) to allow one to work around the name collision.

Let me know if this is of interest and I'll submit a pull request.

gr discover failes on Windows

Windows 7
Installed Node.JS and NPM installed with Chocolatey by nodejs.install (Which uses the official installer)
Running in Node.js Command Prompt

gr discover

events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1001:11)
at Process.ChildProcess._handle.onexit (child_process.js:792:34)

The current method for detecting submodules does not work in all cases.

Say the .git directory is in foo/, and the submodule path is foo/bar/submodule... then the way we are currently checking for a submodule directory fails as mentioned in #65.

Also, I have come across an issue on Windows 7 where the current method fails even when the submodule path is foo/submodule.

Overall, as @bimlas mentions in #54 / #65, it would be much better if we check for git directories by executing a variant of the command 'git rev-parse. Specifically, the best command to use is git rev-parse --is-inside-git-dir', which returns true if the directory is the working tree, false if it is in the .git tree (i.e. untracked, but in a place where git commands are still valid), and throws a fatal error if it is not a git directory.

Deprecation warning node 7

There's a deprecation warning on running gr tag discover.

$ node --version
v7.2.0
(node:42479) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

Full output:

gr tag discover ~/projects/apath/
[gr] 3328/3328 Scanning /Users/timja/apath/* for .git directories (depth 5)
(node:42479) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
Tags updated. Run `gr status` or `gr tag list` to see the current state.

Spaces not supported in repo names

Repo name: "Fuck RITs Emails"

~ » gr tag discover                                                  zach@zbmbp
Tags updated. Run `gr status` or `gr tag list` to see the current state.
------------------------------------------------------------
~ » gr status                                                        zach@zbmbp
~/Development/Fuck     Clean                     @Emails @RITs
exec error: Error: spawn ENOENT

Windows: ENOENT when running gr discover with no EDITOR environment variable set

Trying to run gr discover without EDITOR system environment variable results in following message (which is not sufficiently descriptive):

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: spawn nano ENOENT
    at exports._errnoException (util.js:855:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at nextTickCallbackWith2Args (node.js:455:9)
    at process._tickCallback (node.js:369:17)
    at Function.Module.runMain (module.js:432:11)
    at startup (node.js:141:18)
    at node.js:980:3

As a user, I would like to have a more informative message and documentation with instructions on setting up the environment so git-run can operate successfully.

NOTE: this also occurs in GIT command line despite it having VIM as its own default text editor.

Workaround: set EDITOR environment variable to point to the executable of your chosen command line text editor.

More ways to filter repositories

I think it is great that I can filter my repositories by tags, but quite often, when working with multiple repositories, I need to run my git command on a subset of the tagged repositories.

Couple of specific points of interest that might be good candidates for filtering:

  1. status of the repo: modified/unmodified, ahead or behind
  2. name of the active branch

First one could be triggered with -s <modified | clean | ahead | behind>.

Second could be triggered by -b <branch_name>

ENOENT error executing the command "pull" (solved)

nathanh-mbp:~ nathanh$ gr @sample git pull

in ~/Git/Samples/Adapters

ENOENT error executing the command "pull" in /Users/nathanh/Git/Samples/Adapters. Please make sure you have installed an executable named "pull" in $PATH.

Am I missing something? Is this a known issue?

install details

Hello I am using a Mac and do not know how to install this.
Could you enhance you documentation to explain the install procedure please ?
Thanks.

Update documentation to state where tags are stored?

Hello,

this looks like a great project. I was thinking I had to write something like this myself, now I don't have to.

I have a minor request for the documentation: Could you mention where tags are actually stored? Does gr have a config file where it keeps all that information, or is it somehow added to each git repository?

Thanks!

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.