gr
gr copied to clipboard
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
+1 this is really essential to make gr
usable and not have to configure it again each time you deploy to a new server.
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.
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)