Support custom classes for alt-links (#21)
Class can be set using `yadm config alt.class <class>`
This commit is contained in:
parent
d7abc7ff41
commit
ce4ed41f10
1 changed files with 8 additions and 2 deletions
10
yadm
10
yadm
|
@ -108,6 +108,12 @@ function alt() {
|
||||||
|
|
||||||
require_repo
|
require_repo
|
||||||
|
|
||||||
|
match_class="$(config alt.class)"
|
||||||
|
if [ -z "$match_class" ] ; then
|
||||||
|
match_class="()"
|
||||||
|
fi
|
||||||
|
match_class="(%|$match_class)"
|
||||||
|
|
||||||
match_system="$(config alt.os)"
|
match_system="$(config alt.os)"
|
||||||
if [ -z "$match_system" ] ; then
|
if [ -z "$match_system" ] ; then
|
||||||
match_system=$(uname -s)
|
match_system=$(uname -s)
|
||||||
|
@ -127,8 +133,8 @@ function alt() {
|
||||||
fi
|
fi
|
||||||
match_user="(%|$match_user)"
|
match_user="(%|$match_user)"
|
||||||
|
|
||||||
#; regex for matching "<file>##SYSTEM.HOSTNAME.USER"
|
#; regex for matching "<file>##CLASS.SYSTEM.HOSTNAME.USER"
|
||||||
match="^(.+)##($match_system|$match_system\.$match_host|$match_system\.$match_host\.$match_user|())$"
|
match="^(.+)##(()|$match_class|$match_system|$match_class\.$match_system|$match_system\.$match_host|$match_class\.$match_system\.$match_host|$match_system\.$match_host\.$match_user|$match_class\.$match_system\.$match_host\.$match_user)$"
|
||||||
|
|
||||||
#; process relative to YADM_WORK
|
#; process relative to YADM_WORK
|
||||||
YADM_WORK=$(unix_path "$("$GIT_PROGRAM" config core.worktree)")
|
YADM_WORK=$(unix_path "$("$GIT_PROGRAM" config core.worktree)")
|
||||||
|
|
Loading…
Reference in a new issue