commit 230ee0e0c2bf6ea69d04f6c86128b5d49f7a42e3
parent c52dd5cdd96fbdeb08f9fb4e7546f051e6090d30
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Fri, 13 Dec 2019 13:47:24 -0500
Small changes to setup files
Former-commit-id: 68aab2a1e99205daae5d5c724cb0c40ab1178fa7
Diffstat:
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/install.sh b/install.sh
@@ -3,12 +3,12 @@
# Preliminary checks {{{
# Check if this directory was cloned properly
-if [ $(pwd) != "$HOME/.dotfiles" ]; then
+if [ "$(pwd)" != "$HOME/.dotfiles" ]; then
echo "Please clone this directory as $HOME/.dotfiles."
exit 1
fi
-cd "$(dirname $0)"
+cd "$(dirname "$0")" || { echo "Could not cd into $(dirname "$0")"; exit 1; }
if ! [ -f "./install.sh" ]; then
echo "Please cd into $HOME/.dotfiles before running the script."
@@ -35,20 +35,24 @@ fi
export DOTFILES="$HOME/.dotfiles"
-read -n 1 -p "Install all dotfiles? [Y/n]" yn
+read -rn 1 -p "Install all dotfiles? [Y/n]" yn
echo
case $yn in
- [Yy]* )
+ [Yy]* )
yes | scripts/conf link
echo "Dotfiles installed."
echo "Run \`conf -h\` for more help."
;;
- * )
+ * )
echo "No dotfiles installed automatically."
echo "Run \`scripts/conf -h\` for more help."
+ echo "You can also add conf to your path: export PATH=$DOTFILES/scripts:$PATH"
;;
esac
echo "Don't forget to create a ~/.secret_env_variables with:"
+# Don't want these variables to expand
+# shellcheck disable=SC2016
echo '- $DISCOGS_API_TOKEN'
+# shellcheck disable=SC2016
echo '- $HOMEBREW_GITHUB_API_TOKEN'
diff --git a/scripts/conf b/scripts/conf
@@ -8,8 +8,11 @@ DOTFILES="${DOTFILES}";
mapfile="dot.map";
# Begin script
+
+# Create the mappings assoc. array
declare -A mappings;
+# Utility function to pretty-print mappings assoc array
pp_mappings() {
echo "{"
for f in "${!mappings[@]}"; do