Browse Source

Added a few comments for readability

pull/206/head
Scott Walsh 1 year ago
parent
commit
bd92a61c2d
  1. 14
      setup.sh

14
setup.sh

@ -21,15 +21,19 @@ env=".env"
bootstrap_file="$fabric_path$bootstrap"
context_file="$fabric_path$context"
env_file=$fabric_path$env
# Ensure the directory for the bootstrap file exists
mkdir -p "$(dirname "$bootstrap_file")"
mkdir -p "$fabric_path"
# check for the alias file- create if it doesn't exist
if [ -e "$bootstrap_file" ]; then
echo "$bootstrap_file exists. Will only append new aliases"
else
touch $bootstrap_file
echo "created $bootstrap_file"
fi
# check for the context file- create if it doesn't exist
if [ -e "$context_file" ]; then
echo "$context_file exists. Doing nothing"
else
@ -44,21 +48,25 @@ for config_file in "${config_files[@]}"
do
# Check if the configuration file exists
if [ -e "$config_file" ]; then
# we could optionally 'break' after configuring a single file
echo "Checking $config_file"
# Ensure the bootstrap script is sourced from the shell configuration file
source_line="if [ -f \"$bootstrap_file\" ]; then . \"$bootstrap_file\"; fi"
if ! grep -qF -- "$source_line" "$config_file"; then
echo -e "\n# Load custom aliases for fabric\n$source_line" >> "$config_file"
echo "Added source command for $bootstrap_file in $config_file."
fi
fi
done
# if you don't have a .env for fabric, fabric --list will tell you to run --setup
# which will break alias creation below
if [ ! -e "$env_file" ]; then
fabric --setup
fi
# set aliases for all known patterns
# set aliases for all known patterns, skip for existing patterns
echo "Checking alises:"
for i in $(fabric --list)
do

Loading…
Cancel
Save