Remove dotfiles link command
And my wills of making it a fully featured dotfiles handling application. By now I'm used to do that manually so heh, why not. (why did I start writing leggible commits descriptions?)
This commit is contained in:
parent
78bbd1b44d
commit
1404d5aaab
|
@ -154,56 +154,6 @@ function _dotfiles-install-dir { # dir
|
|||
|
||||
# Script functions
|
||||
|
||||
function dotfiles_link_help {
|
||||
echo "Usage: $0 link DOTFILE"
|
||||
echo
|
||||
echo "Arguments:"
|
||||
echo " DOTFILE Path to the dotfile"
|
||||
return 0
|
||||
|
||||
}
|
||||
function dotfiles_link { # file
|
||||
if [ -z $1 ]; then
|
||||
dotfiles_link_help
|
||||
return 1
|
||||
fi
|
||||
absSource="$(realpath $1 2> /dev/null)"
|
||||
if [[ $? != 0 || ! -e "$absSource" ]]; then
|
||||
echo "[ERROR] $1: no such file or directory"
|
||||
return 1
|
||||
fi
|
||||
relSource="$(relativePath $DOTHOME $absSource)"
|
||||
|
||||
absTarget="$DOTREPO/$relSource"
|
||||
relTarget="$(relativePath "$DOTHOME/$dir" "$absTarget")"
|
||||
|
||||
if [ -f "$absTarget" ]; then
|
||||
echo "[ERROR/UNIMPLEMENTED] $relSource is already linked to ... something"
|
||||
return 2
|
||||
fi
|
||||
|
||||
if [ -f "$absSource" ]; then
|
||||
if [ -d "$(dirname "$absTarget")" ]; then
|
||||
cmd="mv $absSource $absTarget"
|
||||
cmd2="ln --symbolic --no-dereference $relTarget $absSource"
|
||||
if [ $DRY_RUN ]; then
|
||||
echo $cmd
|
||||
echo $cmd2
|
||||
else
|
||||
$cmd
|
||||
$cmd2
|
||||
fi
|
||||
|
||||
else
|
||||
echo "[UNIMPLEMENTED] Linking a file in a directory that don't already exists"
|
||||
fi
|
||||
else
|
||||
echo "[UNIMPLEMENTED] Linking things other than a file"
|
||||
return 12
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function dotfiles_install {
|
||||
_dotfiles-install-dir /
|
||||
}
|
||||
|
@ -221,7 +171,6 @@ function dotfiles_help {
|
|||
echo
|
||||
echo "Commands:"
|
||||
echo " install Install dotfiles from repository"
|
||||
echo " link Add dotfile to repository"
|
||||
echo " help Get help with commands"
|
||||
echo
|
||||
echo "Environment variables:"
|
||||
|
@ -239,8 +188,3 @@ else
|
|||
dotfiles_help
|
||||
fi
|
||||
|
||||
# TODO dotfiles-{link,unlink,clean,uninstall}, better handling of DRY_RUN (use functions probably), clarify source/target thingy
|
||||
# Link and Unlink should have a clever behavior regarding
|
||||
# recusive folders
|
||||
# Ex : linking config/i3 should make config recursible
|
||||
# Ex : linking config if some files in it are linked should unlink those
|
||||
|
|
Loading…
Reference in a new issue