X-Git-Url: https://apps.delaporte.us/gitweb/dotfiles.git/blobdiff_plain/aedaada157e561da06b77c23054c8db76c36ce48..b5c4353d4750fd3e38da3230830ab781f61c2b97:/bin/dot diff --git a/bin/dot b/bin/dot index 6173ee1..aa633ec 100755 --- a/bin/dot +++ b/bin/dot @@ -4,10 +4,6 @@ ANSIBLE="$ENVS/ansible/bin/ansible-playbook" read -d '' HELP << EOF dot - a (mostly) one script dotfiles manager -1. Install this file on your path -2. Clone your (or my) 'dotfiles' repository to ~/dotfiles -3. Run 'dot help' to get started. - Copyright 2026 Edward Delaporte V Licensed under AGPLv3 and later. @@ -18,22 +14,53 @@ dot link FILE updates ~/dot.HOSTNAME.yaml to include a symlink from ~/dotfiles/files/FILE to ~/.FILE +dot check + check setup against ~/backup/dot.HOSTNAME.yaml + +dot apply + apply config in ~/backup/dot.HOSTNAME.yaml + +dot help FEATURE + setup - more information on setup + all - additional features +EOF + +read -d '' SETUP_HELP << EOF +## Setup + +1. Install this file on your path +2. Clone your (or my) 'dotfiles' repository to ~/dotfiles +3. Run 'dot help' to get started. + +EOF + + +read -d '' EXTRA_HELP << EOF + dot install SCRIPT updates ~/dot.HOSTNAME.yaml to run ~/dotfiles/SCRIPT.sh if it has not yet been run creates ~/dot/SCRIPT.installed after SCRIPT has been run -dot check - check setup against ~/dot.HOSTNAME.yaml - -dot apply - apply config in ~/dot.HOSTNAME.yaml EOF + if [ ! -n "$1" ] || [ "$1" == "help" ]; then echo "$HELP" fi +if [ "$1" == "help" ] && [ "$2" == "all" ]; then + echo "" + echo "$EXTRA_HELP" + echo "" + echo "$SETUP_HELP" +fi +if [ "$1" == "help" ] && [ "$2" == "setup" ]; then + echo "" + echo "$SETUP_HELP" +fi + # set -v +# TASKFILE="$HOME/backup/dot.$HOSTNAME.yaml" LINKFILES="$HOME/dotfiles/files" @@ -106,6 +133,20 @@ read -d '' LINK_THIS_FILE << EOF state: "link" EOF +if [[ "$2" == *"."* ]];then + # File already contains a dot +read -d '' LINK_THIS_FILE << EOF + + - name: symlink $2 + ansible.builtin.file: + src: "$LINKFILES/$2" + dest: "$HOME/$2" + state: "link" +EOF + + +fi + echo " $LINK_THIS_FILE" >> $TASKFILE echo "$2 added to symlinks in $TASKFILE" echo "Run 'dot apply' to create all configured symlinks"