gr icon indicating copy to clipboard operation
gr copied to clipboard

Expand tilde for $HOME in grconfig.json

Open eriknomitch opened this issue 9 years ago • 3 comments

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

eriknomitch avatar Dec 06 '15 22:12 eriknomitch

+1 this is really essential to make gr usable and not have to configure it again each time you deploy to a new server.

xapple avatar Mar 22 '16 14:03 xapple

The worst is that it doesn't even tell you it's a problem so you can search for hours. You just see:

 $ gr git pull
 Skipped  as it does not have a .git subdirectory.

xapple avatar Mar 26 '16 14:03 xapple

Here is my install script that auto-generates the config file if it can help anyone.

import sh, glob, os
sh.npm('install', '-g', 'git-run')

home = os.environ.get('HOME', '~') + '/'
repo = home + 'repos/'
repos = glob.glob(repo + '*')
path = home + '.grconfig.json'

text =  """
{
  "tags": {
    "all": [
      %s
    ]
  }
}""" % ',\n      '.join(('"%s"' % r for r in repos))
with open(path, 'w') as handle: handle.write(text)

xapple avatar Mar 26 '16 15:03 xapple