Skip to content

Commit

Permalink
GPT-commit: Refactored setup.sh and argparse-services.sh.
Browse files Browse the repository at this point in the history
GPT-commit: Refactored setup.sh and argparse-services.sh, and modified functions and variables to improve code readability and maintainability.
  • Loading branch information
hwixley committed Oct 29, 2023
1 parent 2f210dd commit 4b88995
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ for i in "${files[@]}"; do
touch "${md_dir}/${i}"
chmod +rwx "${md_dir}/${i}"
else
warn_text "File ${i} already exists. Would you like to overwrite it? [[ y / n ]"
warn_text "File ${i} already exists. Would you like to overwrite it? [ y / n ]"
read -r overwrite_file
if [[ "${overwrite_file}" = "y" ]]; then
rm "${md_dir}/${i}"
Expand Down Expand Up @@ -109,7 +109,7 @@ echo ""
echo "The default directory aliases setup are as follows:"
echo "1) docs = ~/Documents"
echo "2) down = ~/Downloads"
h1_text "Would you like to include these? [[ y / n ]"
h1_text "Would you like to include these? [ y / n ]"
read -r keep_default_diraliases
if [[ "${keep_default_diraliases}" = "y" ]]; then
{ echo "docs=~/Documents"; echo "down=~/Downloads"; } >> ${md_dir}/dir-aliases.txt
Expand All @@ -123,7 +123,7 @@ info_text "Okay we should be good to go!"
envfile=$(envfile)
alias_check=$(alias wix)
if [[ "${alias_check}" != "" ]]; then
warn_text "It looks like you already have a wix alias setup. Would you like to overwrite it? [[ y / n ]"
warn_text "It looks like you already have a wix alias setup. Would you like to overwrite it? [ y / n ]"
read -r overwrite_alias
if [[ "${overwrite_alias}" = "y" ]]; then
echo "${ORANGE}Please edit the ${envfile} file manually to remove your old alias${RESET}"
Expand All @@ -138,7 +138,7 @@ completionfile="${HOME}/.bash_completion"
if [[ -f "${completionfile}" ]]; then
completion_search=$(cat "${completionfile}" | grep -c "$(pwd)/src/completion.sh")
if [[ "${completion_search}" != "" ]]; then
warn_text "It looks like you already have wix completion setup. Would you like to overwrite it? [[ y / n ]"
warn_text "It looks like you already have wix completion setup. Would you like to overwrite it? [ y / n ]"
read -r overwrite_completion
if [[ "${overwrite_completion}" = "y" ]]; then
echo "${ORANGE}Please edit the ${HOME}/.bashrc file manually to remove your old completion${RESET}"
Expand All @@ -149,7 +149,7 @@ if [[ -f "${completionfile}" ]]; then
fi
else
warn_text "It looks like you don't have a ${HOME}/.bash_completion file (allowing you to use the wix command with tab-completion)."
warn_text "Would you like to create one? [[ y / n ]"
warn_text "Would you like to create one? [ y / n ]"
read -r create_completion
if [[ "${create_completion}" = "y" ]]; then
touch "${HOME}/.bash_completion"
Expand Down
8 changes: 4 additions & 4 deletions src/argparse-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ ginit() {
info_text "Provide a name for this repository:"
read -r rname
echo "# ${rname}" >> README.md
info_text "Would you like to add a MIT license to this repository? [[ Yy / Nn ]"
info_text "Would you like to add a MIT license to this repository? [ Yy / Nn ]"
read -r rlicense
if [[ "${rlicense}" = "y" ]] || [[ "${rlicense}" = "Y" ]];
then
Expand Down Expand Up @@ -328,11 +328,11 @@ wix_delete() {
if empty "$2" ; then
error_text "You did not provide a path in this directory to delete, try again..."
else
error_text "Are you sure you want to delete ${mydirs[$1]}/$2? [[ Yy / Nn]"
error_text "Are you sure you want to delete ${mydirs[$1]}/$2? [ Yy / Nn]"
read -r response
if [[ "${response}" = "y" ]] || [[ "${response}" = "Y" ]];
then
error_text "Are you really sure you want to delete ${mydirs[$1]}/$2? [[ Yy / Nn]"
error_text "Are you really sure you want to delete ${mydirs[$1]}/$2? [ Yy / Nn]"
read -r response
if [[ "${response}" = "y" ]] || [[ "${response}" = "Y" ]];
then
Expand All @@ -354,7 +354,7 @@ wix_ginit() {
fi

if empty "${branch}" ; then
info_text "Would you like you to host this repository under a GitHub organization? [[ Yy / Nn ]"
info_text "Would you like you to host this repository under a GitHub organization? [ Yy / Nn ]"
read -r response
if [[ "${response}" = "y" ]] || [[ "${response}" = "Y" ]];
then
Expand Down

0 comments on commit 4b88995

Please sign in to comment.