how to refactor path duplication in .mrconfig section headers?
Adam Spiers
vcs-home at adamspiers.org
Fri Oct 28 17:42:16 CEST 2011
If I have multiple repository paths all similar but spread across
different .mrconfig files, e.g.
in ~/.mrconfig
[.config/mr]
checkout = ...
in ~/.config/mr/config.d/CLI:
[$HOME/.git-repos/zsh]
...
[$HOME/.git-repos/mutt]
...
and in ~/.config/mr/config.d/GUI:
[$HOME/.git-repos/urxvt]
...
[$HOME/.git-repos/fonts]
...
then the DRY fascist inside me is irked by the duplication. I'd much
rather write this in ~/.mrconfig:
[DEFAULT]
lib = MR_GIT=$HOME/.git-repos
[.config/mr]
checkout = ...
and then ~/.config/mr/config.d/CLI would have:
[$MR_GIT/zsh]
...
[$MR_GIT/mutt]
...
and in ~/.config/mr/config.d/GUI:
[$MR_GIT/urxvt]
...
[$MR_GIT/fonts]
...
However this doesn't work - I'm guessing that variable expansion in
the section headers is done in Perl, so is not influenced by the
shell-code in the DEFAULT lib?
So is there any other way of avoiding this duplication?
Thanks,
Adam
More information about the vcs-home
mailing list