diff options
author | Jesús <heckyel@hyperbola.info> | 2021-02-10 13:52:52 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2021-02-10 13:52:52 -0500 |
commit | 7e95c3b667a1b353f8275db886203f272bfcce34 (patch) | |
tree | aefe3b7db69ac78b83b79a70cf43401679812d20 /hyperterm/core | |
download | hyperterm-7e95c3b667a1b353f8275db886203f272bfcce34.tar.lz hyperterm-7e95c3b667a1b353f8275db886203f272bfcce34.tar.xz hyperterm-7e95c3b667a1b353f8275db886203f272bfcce34.zip |
first commit
Diffstat (limited to 'hyperterm/core')
-rw-r--r-- | hyperterm/core/autocomplete.sh | 22 | ||||
-rw-r--r-- | hyperterm/core/colors.sh | 96 | ||||
-rw-r--r-- | hyperterm/core/git.sh | 332 | ||||
-rw-r--r-- | hyperterm/core/languages.sh | 30 | ||||
-rw-r--r-- | hyperterm/core/status.sh | 25 | ||||
-rw-r--r-- | hyperterm/core/update.sh | 161 |
6 files changed, 666 insertions, 0 deletions
diff --git a/hyperterm/core/autocomplete.sh b/hyperterm/core/autocomplete.sh new file mode 100644 index 0000000..90edb85 --- /dev/null +++ b/hyperterm/core/autocomplete.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# shellcheck disable=SC1091 +# bash completion on Hyperbola: pacman -S bash-completion +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +# Autocompletado +complete -cf sudo + +shopt -s cdspell +shopt -s checkwinsize +shopt -s cmdhist +shopt -s dotglob +shopt -s expand_aliases +shopt -s extglob +shopt -s histappend +shopt -s hostcomplete diff --git a/hyperterm/core/colors.sh b/hyperterm/core/colors.sh new file mode 100644 index 0000000..af5fcec --- /dev/null +++ b/hyperterm/core/colors.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +function _colors_bash () { + if tput setaf 1 &> /dev/null; then + # If you would like to customize your colors, use + # # example 1 + # for c in {0..255}; do tput setaf $c; tput setaf $c | cat -v; printf '%s\n' "=$c"; done + # # example 2 + # for i in $(seq 0 $(tput colors)); do + # printf '%s\n' " $(tput setaf $i)Text$(tput sgr0) $(tput bold)$(tput setaf $i)Text$(tput sgr0) $(tput sgr 0 1)$(tput setaf $i)Text$(tput sgr0) \$(tput setaf $i)" + # done + + # Reset the shell from our `if` check + tput sgr0 &> /dev/null + # If the terminal supports at least 256 colors, write out our 256 color based set + if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then + BLUE=$(tput setaf 27) + CYAN=$(tput setaf 39) + GREEN=$(tput setaf 76) + GREY=$(tput setaf 250) + LEMON=$(tput setaf 154) + ORANGE=$(tput setaf 172) + PURPLE=$(tput setaf 200) + RED=$(tput setaf 9) + YELLOW=$(tput setaf 226) + else + # Otherwise, use colors from our set of 8 + BLUE=$(tput setaf 4) + CYAN=$(tput setaf 6) + GREEN=$(tput setaf 2) + GREY=$(tput setaf 7) + LEMON=$(tput setaf 3) + ORANGE=$(tput setaf 4) + PURPLE=$(tput setaf 5) + RED=$(tput setaf 1) + YELLOW=$(tput setaf 3) + fi + BOLD=$(tput bold) + RESET=$(tput sgr0) + else + # Otherwise, use ANSI escape sequences for coloring + # If you would like to customize your colors, use + # DEV: 30-39 lines up 0-9 from `tput` + # for i in $(seq 0 109); do + # echo -n -e "\033[1;${i}mText$(tput sgr0) " + # echo "\033[1;${i}m" + # done + BLUE='\033[1;34m' + CYAN='\033[1;36m' + GREEN='\033[1;32m' + GREY='\033[0;37m' + LEMON='\033[1;33m' + ORANGE='\033[1;33m' + PURPLE='\033[1;35m' + RED='\033[1;31m' + WHITE='\033[1m' + YELLOW='\033[1;33m' + + BOLD='' + RESET='\033[m' + fi + + # Define the default prompt terminator character '$' + if [[ "$UID" == 0 ]]; then + SYMBOL="#" + else + SYMBOL="\$" + fi + + # export + export BLUE + export CYAN + export GREEN + export GREY + export LEMON + export ORANGE + export PURPLE + export RED + export WHITE + export YELLOW + + export BOLD + export RESET + export SYMBOL +} + +# Xterm-colors +_xterm_fackground="xterm*background: black" +_xterm_foreground="xterm*foreground: lightgray" + +if [[ ! -e "$HOME/.Xresources" && $EUID -ne 0 ]]; then + printf '%s\n%s' "$_xterm_fackground" "$_xterm_foreground" | tee -a "$HOME/.Xresources" &> /dev/null + xrdb "$HOME/.Xresources" &> /dev/null +else + xrdb "$HOME/.Xresources" &> /dev/null +fi diff --git a/hyperterm/core/git.sh b/hyperterm/core/git.sh new file mode 100644 index 0000000..17bb575 --- /dev/null +++ b/hyperterm/core/git.sh @@ -0,0 +1,332 @@ +#!/bin/bash + +# Set up symbols +function _symbols() { + + # Import colors + _colors_bash "$@" + + _synced_symbol="$(printf '%b\u2714' "${BOLD}${CYAN}")" # ✔ + _dirty_synced_symbol="$(printf '%b\u002A' "${BOLD}${RED}")" # ∗ + _unpushed_symbol="$(printf '%b\u2191' "${BOLD}${CYAN}")" # ↑ + _dirty_unpushed_symbol="$(printf '%b\u25B2' "${BOLD}${YELLOW}")" # ▲ + _unpulled_symbol="$(printf '%b\u25BD' "${BOLD}${GREEN}")" # ▽ + _dirty_unpulled_symbol="$(printf '%b\u25BC' "${BOLD}${RED}")" # ▼ + _stage_symbol="$(printf '%b\u2192\u004D' "${BOLD}${CYAN}")" # →M + _unstage_symbol="$(printf '%b\u2190\u004D' "${BOLD}${RED}")" # ←M + _untracked_symbol="$(printf '%b\u003F' "${BOLD}${RED}")" # ? + _newfile_symbol="$(printf '%b\u002B' "${BOLD}${CYAN}")" # + + _deleted_file_symbol="$(printf '%b\u2013' "${BOLD}${RED}")" # – + _renamed_symbol="$(printf '%b\u2387 ' "${BOLD}${RED}")" # ⎇ + _unpushed_unpulled_symbol="$(printf '%b\u2B21' "${BOLD}${RED}")" # ⬡ + _dirty_unpushed_unpulled_symbol="$(printf '%b\u2B22' "${BOLD}${RED}")" # ⬢ +} + +function _get_git_branch() { + # On branches, this will return the branch name + # On non-branches, (no branch) + ref="$(git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///')" + if [[ -n $ref ]]; then + printf '%s' "$ref" + else + printf "(no branch)" + fi +} + +function _get_git_progress() { + # Detect in-progress actions (e.g. merge, rebase) + # https://github.com/git/git/blob/v1.9-rc2/wt-status.c#L1199-L1241 + git_dir="$(git rev-parse --git-dir)" + + # git merge + if [[ -f "$git_dir/MERGE_HEAD" ]]; then + printf " [merge]" + elif [[ -d "$git_dir/rebase-apply" ]]; then + # git am + if [[ -f "$git_dir/rebase-apply/applying" ]]; then + printf " [am]" + # git rebase + else + printf " [rebase]" + fi + elif [[ -d "$git_dir/rebase-merge" ]]; then + # git rebase --interactive/--merge + printf " [rebase]" + elif [[ -f "$git_dir/CHERRY_PICK_HEAD" ]]; then + # git cherry-pick + printf " [cherry-pick]" + fi + if [[ -f "$git_dir/BISECT_LOG" ]]; then + # git bisect + printf " [bisect]" + fi + if [[ -f "$git_dir/REVERT_HEAD" ]]; then + # git revert --no-commit + printf " [revert]" + fi +} + +_prompt_is_branch1_behind_branch2 () { + # $ git log origin/master..master -1 + # commit 4a633f715caf26f6e9495198f89bba20f3402a32 + # Author: Todd Wolfson <todd@twolfson.com> + # Date: Sun Jul 7 22:12:17 2013 -0700 + # + # Unsynced commit + + # Find the first log (if any) that is in branch1 but not branch2 + first_log="$(git log "$1..$2" -1 2> /dev/null)" + + # Exit with 0 if there is a first log, 1 if there is not + [[ -n "$first_log" ]] +} + +_prompt_branch_exists () { + # List remote branches | # Find our branch and exit with 0 or 1 if found/not found + git branch --remote 2> /dev/null | grep --quiet "$1" +} + +_prompt_parse_git_ahead () { + # Grab the local and remote branch + branch="$(_get_git_branch)" + remote="$(git config --get "branch.${branch}.remote" || echo -n "origin")" + remote_branch="$remote/$branch" + + # $ git log origin/master..master + # commit 4a633f715caf26f6e9495198f89bba20f3402a32 + # Author: Todd Wolfson <todd@twolfson.com> + # Date: Sun Jul 7 22:12:17 2013 -0700 + # + # Unsynced commit + + # If the remote branch is behind the local branch + # or it has not been merged into origin (remote branch doesn't exist) + if (_prompt_is_branch1_behind_branch2 "$remote_branch" "$branch" || + ! _prompt_branch_exists "$remote_branch"); then + # printf our character + printf '%s' '0' + fi +} + +_prompt_parse_git_behind() { + # Grab the branch + branch="$(_get_git_branch)" + remote="$(git config --get "branch.${branch}.remote" || echo -n "origin")" + remote_branch="$remote/$branch" + + # $ git log master..origin/master + # commit 4a633f715caf26f6e9495198f89bba20f3402a32 + # Author: Todd Wolfson <todd@twolfson.com> + # Date: Sun Jul 7 22:12:17 2013 -0700 + # + # Unsynced commit + + # If the local branch is behind the remote branch + if _prompt_is_branch1_behind_branch2 "$branch" "$remote_branch"; then + # printf our character + printf '%s' '0' + fi +} + +function _prompt_parse_git_dirty() { + # If the git status has *any* changes (e.g. dirty), printf our character + if [[ -n "$(git status --porcelain 2> /dev/null)" ]]; then + printf '%s' '0' + fi +} + +# start counter on git +function _git_dirty_count() { + local _dirty_status + local _git_status + _dirty_status="$(_prompt_parse_git_dirty)" + _git_status="$(git status --porcelain 2> /dev/null)" + if [[ "$_dirty_status" == 0 ]]; then + local change_count + change_count="$(echo "$_git_status" | wc -l | tr -d '[:space:]')" + if [[ "$change_count" == 1 ]]; then + printf '%b\u2022%s' "${BOLD}${GREY}" "$change_count" + elif [[ "$change_count" == 2 ]]; then + printf '%b\u2236%s' "${BOLD}${GREY}" "$change_count" + elif [[ "$change_count" == 3 ]]; then + printf '%b\u2026%s' "${BOLD}${GREY}" "$change_count" + else + printf '%b\u00BB%s' "${BOLD}${GREY}" "$change_count" + fi + else + printf '' + fi +} +# ends counter on git + +function _prompt_parse_git_untracked() { + local untracked + local evaltask + untracked="$(git status 2>&1 | tee)" + grep -E 'Untracked files:' <<<"$untracked" &> /dev/null + evaltask=$? + if [ "$evaltask" -eq 0 ]; then + printf '%s' '0' + else + printf '%s' '1' + fi +} + +function _prompt_parse_git_newfile() { + local newfile + local evaltask + newfile="$(git status 2>&1 | tee)" + grep -E 'new file:' <<<"$newfile" &> /dev/null + evaltask=$? + if [ "$evaltask" -eq 0 ]; then + printf '%s' '0' + else + printf '%s' '1' + fi +} + +function _prompt_parse_git_deleted_file() { + local deleted_file + local evaltask + deleted_file="$(git status 2>&1 | tee)" + grep -E 'deleted:' <<<"$deleted_file" &> /dev/null + evaltask=$? + if [ "$evaltask" -eq 0 ]; then + printf '%s' '0' + else + printf '%s' '1' + fi +} + +function _prompt_parse_git_renamed() { + local renamed + local evaltask + renamed="$(git status 2>&1 | tee)" + grep -E 'renamed:' <<<"$renamed" &> /dev/null + evaltask=$? + if [ "$evaltask" -eq 0 ]; then + printf '%s' '0' + else + printf '%s' '1' + fi +} + +function _prompt_parse_git_unstage() { + local unstage + local evaltask + unstage="$(git status 2>&1 | tee)" + grep -E 'not staged' <<<"$unstage" &> /dev/null + evaltask=$? + if [ "$evaltask" -eq 0 ]; then + printf '%s' '0' + else + printf '%s' '1' + fi +} + +function _prompt_parse_git_stage() { + local stage + local evaltask + stage="$(git status -s 2>&1 | tee)" + grep -E 'M' <<<"$stage" &> /dev/null + evaltask=$? + if [ "$evaltask" -eq 0 ]; then + printf '%s' '0' + else + printf '%s' '1' + fi +} + +function _prompt_is_on_git() { + git rev-parse 2> /dev/null +} + +function _prompt_get_git_status() { + + _symbols "$@" + + # Grab the git dirty and git behind + git_count="$(_git_dirty_count)" + dirty_branch="$(_prompt_parse_git_dirty)" + branch_ahead="$(_prompt_parse_git_ahead)" + branch_behind="$(_prompt_parse_git_behind)" + branch_stage="$(_prompt_parse_git_stage)" + branch_unstage="$(_prompt_parse_git_unstage)" + branch_untracked="$(_prompt_parse_git_untracked)" + branch_newfile="$(_prompt_parse_git_newfile)" + branch_deleted_file="$(_prompt_parse_git_deleted_file)" + branch_renamed="$(_prompt_parse_git_renamed)" + + # Iterate through all the cases and if it matches, then printf + if [[ "$dirty_branch" == 0 && "$branch_ahead" == 0 && "$branch_behind" == 0 ]]; then + printf '%s%s' "$_dirty_unpushed_unpulled_symbol" "$git_count" + + elif [[ "$branch_ahead" == 0 && "$branch_behind" == 0 ]]; then + printf '%s%s' "$_unpushed_unpulled_symbol" "$git_count" + + elif [[ "$dirty_branch" == 0 && "$branch_ahead" == 0 ]]; then + printf '%s%s' "$_dirty_unpushed_symbol" "$git_count" + + elif [[ "$branch_ahead" == 0 ]]; then + printf '%s%s' "$_unpushed_symbol" "$git_count" + + elif [[ "$dirty_branch" == 0 && "$branch_behind" == 0 ]]; then + printf '%s%s' "$_dirty_unpulled_symbol" "$git_count" + + elif [[ "$branch_behind" == 0 ]]; then + printf '%s%s' "$_unpulled_symbol" "$git_count" + + elif [[ "$branch_unstage" == 0 && "$branch_untracked" == 0 ]]; then + printf '%s%s' "${_unstage_symbol}${_untracked_symbol}" "$git_count" + + elif [[ "$branch_stage" == 0 && "$branch_untracked" == 0 ]]; then + printf '%s%s' "${_stage_symbol}${_untracked_symbol}" "$git_count" + + elif [[ "$branch_stage" == 0 && "$branch_unstage" == 0 ]]; then + printf '%s%s' "$_unstage_symbol" "$git_count" + + elif [[ "$branch_newfile" == 0 && "$branch_untracked" == 0 ]]; then + printf '%s%s' "${_newfile_symbol}${_untracked_symbol}" "$git_count" + + elif [[ "$branch_untracked" == 0 ]]; then + printf '%s%s' "$_untracked_symbol" "$git_count" + + elif [[ "$branch_stage" == 0 ]]; then + printf '%s%s' "$_stage_symbol" "$git_count" + + elif [[ "$branch_newfile" == 0 ]]; then + printf '%s%s' "$_newfile_symbol" "$git_count" + + elif [[ "$branch_deleted_file" == 0 ]]; then + printf '%s%s' "$_deleted_file_symbol" "$git_count" + + elif [[ "$branch_renamed" == 0 ]]; then + printf '%s%s' "$_renamed_symbol" "$git_count" + + elif [[ "$dirty_branch" == 0 ]]; then + printf '%s%s' "$_dirty_synced_symbol" "$git_count" + + else # clean + printf '%s' "$_synced_symbol" + fi +} + +_prompt_get_git_info() { + # Import colors + _colors_bash "$@" + + # Grab the branch + branch="$(_get_git_branch)" + + # If there are any branches + if [[ -n $branch ]]; then + # Printf the branch + output="$branch" + + # Add on the git status + output="$output$(_prompt_get_git_status "$@")" + + # Printf our output + printf '%b%s%b' "${BOLD}${LEMON}" "git:($output" "${BOLD}${LEMON})" + fi +} diff --git a/hyperterm/core/languages.sh b/hyperterm/core/languages.sh new file mode 100644 index 0000000..e0876e6 --- /dev/null +++ b/hyperterm/core/languages.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +################### +# Message functions +################### + +# firts arguments is spanish +# second arguments is english + +function msg() { + case ${LANG/_*/} in + es) + printf '%s\n' "$1" + ;; + *) + printf '%s\n' "$2" + ;; + esac +} + +function msg_err() { + case ${LANG/_*/} in + es) + printf '%s\n' "$1" >&2 + ;; + *) + printf '%s\n' "$2" >&2 + ;; + esac +} diff --git a/hyperterm/core/status.sh b/hyperterm/core/status.sh new file mode 100644 index 0000000..d5f5dc5 --- /dev/null +++ b/hyperterm/core/status.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# System Status +function exitstatus(){ + local retval=$? + unset status + + # Import colors + _colors_bash "$@" + + case $retval in + 0) + status="[${retval}]" + printf '%b%s' "${BOLD}${CYAN}" "${status}" + ;; + 1) + status="[${retval}]" + printf '%b%s' "${BOLD}${PURPLE}" "${status}" + ;; + *) + status="[${retval}]" + printf '%b%s' "${BOLD}${RED}" "${status}" + ;; + esac +} diff --git a/hyperterm/core/update.sh b/hyperterm/core/update.sh new file mode 100644 index 0000000..6794a99 --- /dev/null +++ b/hyperterm/core/update.sh @@ -0,0 +1,161 @@ +#!/bin/bash +# shellcheck source=/dev/null +#------------------ +# Update functions +#------------------ +function _which() { + command -v "$1" &> /dev/null +} + +# Check URL's +# --------------------- +function _url_exists() { + if _which wget; then + if wget --spider "$1" 2>/dev/null; then + return 0 # URL 'ok' + else + return 1 # URL 'fail' + fi + elif _which curl; then + if curl --output /dev/null --silent --head --fail "$1"; then + return 0 # URL 'ok' + else + return 1 # URL 'fail' + fi + fi +} + +function _urls() { + URL_1="https://git.sr.ht/~heckyel/hyperterm" + URL_2="https://notabug.org/heckyel/hyperterm" + + if [[ $(_url_exists "$URL_1") -eq 0 ]]; then + URL="$URL_1" + RAW="$URL_1/blob/master" + elif [[ $(_url_exists "$URL_2") -eq 0 ]]; then + URL="$URL_2" + RAW="$URL_2/raw/master" + fi +} +# ---------------------- + +function ifexists_custom() { + + _urls "$@" + + if [ ! -e "$HOME/.hyperterm/_custom.sh" ]; then + case $1 in + wget) wget "$RAW/hyperterm/_custom.sh" -O "$HOME/.hyperterm/_custom.sh" ;; + curl) curl "$RAW/hyperterm/_custom.sh" -o "$HOME/.hyperterm/_custom.sh" ;; + git) cp -v /tmp/hyperterm/hyperterm/_custom.sh "$HOME/.hyperterm/" ;; + esac + fi +} + +function updbashrc() { + + _urls "$@" + + # data integration + if _which wget; then + wget -nv "$RAW/hyperterm/hyperterm.sha512" -O "$HOME/.hyperterm/hyperterm.sha512" &> /dev/null + ifexists_custom wget &> /dev/null + elif _which curl; then + curl "$RAW/hyperterm/hyperterm.sha512" -o "$HOME/.hyperterm/hyperterm.sha512" &> /dev/null + ifexists_custom curl &> /dev/null + fi + + # checksum of data verification + (cd "$HOME/.hyperterm/" && sha512sum -c hyperterm.sha512 &> /dev/null) + _interger=$? + + if _which git; then + if [[ "$_interger" -eq 0 ]]; then + # Import colors + _colors_bash "$@" + printf '%b' "${BOLD}${CYAN}" + printf '%s\n' ' __ __ ______ ' + printf '%s\n' ' / / / /_ ______ ___ ____/_ __/__ _________ ___ ' + printf '%s\n' ' / /_/ / / / / __ \/ _ \/ ___// / / _ \/ ___/ __ `__ \ ' + printf '%s\n' ' / __ / /_/ / /_/ / __/ / / / / __/ / / / / / / / ' + printf '%s\n' ' /_/ /_/\__, / .___/\___/_/ /_/ \___/_/ /_/ /_/ /_/ ' + printf '%s\n' ' /____/_/ ' + printf '%s\n' ' ' + printf '%b' "${BOLD}${GREY}" + msg "¡Hurra! HyperTerm se ha actualizado y/o está en la versión actual." \ + "Hooray! HyperTerm has been updated and/or is at the current version." + + msg "Consigue tu copia de HyperTerm en: https://notabug.org/heckyel/hyperterm" \ + "Get your HyperTerm swag at: https://notabug.org/heckyel/hyperterm" + printf '%b\n' "$RESET" + else + if [[ $(_url_exists "$URL") -eq 0 ]]; then + # clone '--depth=1' not support cgit + (git clone $URL /tmp/hyperterm/ --depth=1 &> /dev/null) + printf '%s\r' "##### (33%)" + sleep 1 + # core + for i in autocomplete.sh colors.sh git.sh languages.sh status.sh update.sh; do + install -m644 /tmp/hyperterm/hyperterm/core/$i "$HOME/.hyperterm/core/$i" + done + # themes + for i in default.sh joy.sh light_theme.sh pure.sh special.sh; do + install -m644 /tmp/hyperterm/hyperterm/themes/$i "$HOME/.hyperterm/themes/$i" + done + # tools + (cp -f /tmp/hyperterm/hyperterm/tools/* "$HOME/.hyperterm/tools/" &> /dev/null) + + for i in hyperterm.sh hyperterm.sha512; do + install -m644 /tmp/hyperterm/hyperterm/$i "$HOME/.hyperterm/$i" + done + (cp -f /tmp/hyperterm/.bash_profile "$HOME/" &> /dev/null) + printf '%s\r' "############# (66%)" + (ifexists_custom git &> /dev/null) + sleep 1 + (rm -fr /tmp/hyperterm/) + printf '%s\n' "####################### (100%) done!" + source "$HOME/.bashrc" + else + msg_err "El repo esta deshabilitado o no hay conexión a Internet" \ + "The repo is disabled or connection failed" + return 1 + fi + fi + else + msg_err "No hay curl y git. Por favor, instale los programas para actualizar HyperTerm" \ + "I couldn't find not curl and git. Please, install the programs to update HyperTerm" + return 1 + fi +} + +function updbashrc_custom() { + + _urls "$@" + + if [[ $(_url_exists "$URL") -eq 0 ]]; then + while true + do + function _copy_c() { + if _which wget; then + wget "$RAW/hyperterm/_custom.sh" -O "$HOME/.hyperterm/_custom.sh"; source "$HOME/.bashrc" + elif _which curl; then + curl "$RAW/hyperterm/_custom.sh" -o "$HOME/.hyperterm/_custom.sh"; source "$HOME/.bashrc" + fi + } + + question=$(msg "¿Estás seguro de sobre-escribir _custom.sh? [s/N]: " \ + "Are you sure to overwrite _custom.sh? [y/N]: ") + read -r -p "$question" input + case $input in + [sS]|[yY]) _copy_c "$@"; break ;; + [nN]|"") break ;; + *) msg "Por favor responde sí o no" \ + "Please answer yes or no.";; + esac + done + else + msg_err "El repo esta deshabilitado o no hay conexión a Internet" \ + "The repo is disabled or connection failed" + return 1 + fi +} |