dynamically set VCSH_BASE and XDG_CONFIG_HOME
bernd at bschu.de
bernd at bschu.de
Sun Oct 28 16:58:48 CET 2018
Is it possible not only to handle files in $HOME with vcsh ?
For example, if I want to have git repositories for files in /etc, I
would like to use /etc/.config/vcsh/, because $HOME/.config/vcsh/
would not work. Or is there a way to make it work ?
vcsh should be able to find the next .config/vcsh/ in actual working
dir, as standard git searches for .git.
In then following sccript vcsh is called with the original arguments
after the two variables VCSH_BASE and XDG_CONFIG_HOME are set.
I have no experience with vcsh.
Do you think the following script will work as expected ?
Or is there a design problem ?
#!/bin/sh
export VCSH_BASE
export XDG_CONFIG_HOME
VCSH_BASE="$(realpath .)"
XDG_CONFIG_HOME=""
while :; do
if [ -d "$VCSH_BASE/.config/vcsh" ]; then
break
elif [ "$P" = "/" ]; then
VCSH_BASE=""
break
else
VCSH_BASE="$(dirname "$VCSH_BASE")"
fi
done
if [ "$VCSH_BASE" ]; then
echo "myvcsh: <git-project-dir>=$VCSH_BASE"
XDG_CONFIG_HOME="$VCSH_BASE/.config"
vcsh "$@"
else
echo "ERROR: myvcsh: no .config/vcsh/ found" >&2
echo " To create a new <git-project-dir>: mkdir -p
<git-project-dir>/.config/vcsh" >&2
exit 1
fi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 3919 bytes
Desc: Öffentlicher PGP-Schlüssel
URL: <http://lists.madduck.net/pipermail/vcs-home/attachments/20181028/484849b3/attachment.key>
More information about the vcs-home
mailing list