Skip to content

Commit

Permalink
chore: old_ghfc_history_location is a local variable
Browse files Browse the repository at this point in the history
  • Loading branch information
LangLangBart committed Sep 1, 2024
1 parent d11942c commit 1430b0f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions gh-find-code
Original file line number Diff line number Diff line change
Expand Up @@ -297,17 +297,16 @@ validate_environment() {
die "$GHFC_HISTORY_FILE is a directory"
fi

OLD_GHFC_HISTORY_LOCATION="${BASH_SOURCE%/*}/gh_find_code_history.txt"

if [[ ! -f $GHFC_HISTORY_FILE ]]; then
# This is a temporary workaround needed, because the default location was changed.
if [[ -f $OLD_GHFC_HISTORY_LOCATION ]]; then
local old_ghfc_history_location="${BASH_SOURCE%/*}/gh_find_code_history.txt"
if [[ -f $old_ghfc_history_location ]]; then
echo "Notice: The default location for the history file has changed."
echo -e "From:\t$OLD_GHFC_HISTORY_LOCATION"
echo -e "From:\t$old_ghfc_history_location"
echo -e "To:\t$GHFC_HISTORY_FILE"
echo
command mkdir -p "$(command dirname "${GHFC_HISTORY_FILE}")"
if command mv "$OLD_GHFC_HISTORY_LOCATION" "$GHFC_HISTORY_FILE"; then
if command mv "$old_ghfc_history_location" "$GHFC_HISTORY_FILE"; then
echo "History file successfully moved to: $GHFC_HISTORY_FILE"
echo "Please run the command again to use the new history file location."
exit 0
Expand Down

0 comments on commit 1430b0f

Please sign in to comment.