Skip to content

Commit

Permalink
Improve AI installation
Browse files Browse the repository at this point in the history
  • Loading branch information
yorevs committed Aug 21, 2024
1 parent 017a8d5 commit fb72017
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 87 deletions.
9 changes: 5 additions & 4 deletions bin/apps/bash/hhs-app/plugins/askai/askai.bash
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ function execute() {
script_name="${script_name%.*}.bash"

if [[ -f "${script_name}" ]]; then
read -r -p "File '${script_name}' already exists. Replace (Yes/[No])? " -n 1 ans
echo ''
echo -e "${ORANGE}"
read -rn 1 -p "File '${script_name}' already exists. Overwrite it (y/[n])? " ans
echo -e "${NC}" && [[ -n "${ans}" ]] && echo ''
fi

if [[ -z "${ans}" || $(echo "${ans}" | tr '[:upper:]' '[:lower:]') == "y" ]]; then
echo -en "${BLUE}Saving file: ${WHITE}${script_name}${NC}... "
if [[ -z "${ans}" || "${ans}" != "y" && "${ans}" != 'Y' ]]; then
echo -en "${BLUE}Writing file: ${WHITE}${script_name}${NC}... "
echo "${output}" > "${script_name}"
[[ -s "${script_name}" ]] && echo "${GREEN}OK${NC}"
[[ -f "${script_name}" ]] || echo "${RED}FAILED${NC}"
Expand Down
Loading

0 comments on commit fb72017

Please sign in to comment.