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

Attachment: binBAz363fUJu.bin
Description: Öffentlicher PGP-Schlüssel

_______________________________________________
vcs-home mailing list
vcs-home@lists.madduck.net
https://lists.madduck.net/listinfo/vcs-home

Reply via email to