made local really local
This commit is contained in:
@@ -44,41 +44,49 @@
|
||||
# -n, --no-dir Never create a host directory
|
||||
utaz()
|
||||
{
|
||||
local _ununzip
|
||||
# shellcheck disable=SC2329
|
||||
_ununzip()
|
||||
{
|
||||
unzip -o "$1" -d "$2" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
local _untar
|
||||
# shellcheck disable=SC2329
|
||||
_untar()
|
||||
{
|
||||
tar -xf "$1" -C "$2"
|
||||
}
|
||||
|
||||
local _ungzip
|
||||
# shellcheck disable=SC2329
|
||||
_ungzip()
|
||||
{
|
||||
tar -xzf "$1" -C "$2"
|
||||
}
|
||||
|
||||
local _unbzip2
|
||||
# shellcheck disable=SC2329
|
||||
_unbzip2()
|
||||
{
|
||||
tar -xjf "$1" -C "$2"
|
||||
}
|
||||
|
||||
local _unxz
|
||||
# shellcheck disable=SC2329
|
||||
_unxz()
|
||||
{
|
||||
tar -xJf "$1" -C "$2"
|
||||
}
|
||||
|
||||
local _unlzop
|
||||
# shellcheck disable=SC2329
|
||||
_unlzop()
|
||||
{
|
||||
lzop -d "$1" -o "$2/$(basename "${1%.*}")"
|
||||
}
|
||||
|
||||
local _unlzip
|
||||
# shellcheck disable=SC2329
|
||||
_unlzip()
|
||||
{
|
||||
@@ -89,18 +97,21 @@ utaz()
|
||||
fi
|
||||
}
|
||||
|
||||
local _ununrar
|
||||
# shellcheck disable=SC2329
|
||||
_ununrar()
|
||||
{
|
||||
unrar x -o+ "$1" "$2/" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
local _ununarj
|
||||
# shellcheck disable=SC2329
|
||||
_ununarj()
|
||||
{
|
||||
unarj e "$1" "$2/" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
local _unlha
|
||||
# shellcheck disable=SC2329
|
||||
_unlha()
|
||||
{
|
||||
@@ -109,18 +120,21 @@ utaz()
|
||||
(cd "$2" && lha -x "../$1") >/dev/null 2>&1
|
||||
}
|
||||
|
||||
local _ununace
|
||||
# shellcheck disable=SC2329
|
||||
_ununace()
|
||||
{
|
||||
unace x "$1" "$2/" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
local _un7z
|
||||
# shellcheck disable=SC2329
|
||||
_un7z()
|
||||
{
|
||||
7z x "$1" -o"$2/" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
local _unzstd
|
||||
# shellcheck disable=SC2329
|
||||
_unzstd()
|
||||
{
|
||||
@@ -128,6 +142,7 @@ utaz()
|
||||
tar --zstd -xf "$1" -C "$2"
|
||||
}
|
||||
|
||||
local _uncpio
|
||||
# shellcheck disable=SC2329
|
||||
_uncpio()
|
||||
{
|
||||
@@ -135,6 +150,7 @@ utaz()
|
||||
(cd "$2" && cpio -id < "../$1") >/dev/null 2>&1
|
||||
}
|
||||
|
||||
local _uncabextract
|
||||
# shellcheck disable=SC2329
|
||||
_uncabextract()
|
||||
{
|
||||
@@ -142,6 +158,7 @@ utaz()
|
||||
cabextract "$1" -d "$2/" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
local _undeb
|
||||
# shellcheck disable=SC2329
|
||||
_undeb()
|
||||
{
|
||||
@@ -149,6 +166,7 @@ utaz()
|
||||
dpkg-deb -x "$1" "$2/" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
local _unrpm
|
||||
# shellcheck disable=SC2329
|
||||
_unrpm()
|
||||
{
|
||||
@@ -408,6 +426,7 @@ export -f utaz
|
||||
taz()
|
||||
{
|
||||
# Resolve runtime CPU count for --parallel=auto.
|
||||
local _taz_detect_cpus
|
||||
_taz_detect_cpus()
|
||||
{
|
||||
local cpus=1
|
||||
@@ -421,6 +440,7 @@ taz()
|
||||
printf "%s\n" "$cpus"
|
||||
}
|
||||
|
||||
local _doxz
|
||||
# shellcheck disable=SC2329
|
||||
_doxz()
|
||||
{
|
||||
@@ -441,6 +461,7 @@ taz()
|
||||
return $?
|
||||
}
|
||||
|
||||
local _dolz
|
||||
# shellcheck disable=SC2329
|
||||
_dolz()
|
||||
{
|
||||
@@ -468,6 +489,7 @@ taz()
|
||||
return $?
|
||||
}
|
||||
|
||||
local _dogz
|
||||
# shellcheck disable=SC2329
|
||||
_dogz()
|
||||
{
|
||||
@@ -495,6 +517,7 @@ taz()
|
||||
return $?
|
||||
}
|
||||
|
||||
local _dobz2
|
||||
# shellcheck disable=SC2329
|
||||
_dobz2()
|
||||
{
|
||||
@@ -522,6 +545,7 @@ taz()
|
||||
return $?
|
||||
}
|
||||
|
||||
local _dolzo
|
||||
# shellcheck disable=SC2329
|
||||
_dolzo()
|
||||
{
|
||||
|
||||
@@ -128,6 +128,7 @@ export -f set_colors
|
||||
# D : debug (cyan)
|
||||
disp()
|
||||
{
|
||||
local _disp_print_wrapped
|
||||
_disp_print_wrapped()
|
||||
{
|
||||
local prefix="$1"
|
||||
@@ -241,6 +242,7 @@ export -f disp
|
||||
# Usage: mdcat [file]
|
||||
mdcat()
|
||||
{
|
||||
local _mdcat_style_inline
|
||||
_mdcat_style_inline()
|
||||
{
|
||||
local text="$1"
|
||||
@@ -346,6 +348,7 @@ mdcat()
|
||||
printf "%s\n" "$text"
|
||||
}
|
||||
|
||||
local _mdcat_print_hr
|
||||
_mdcat_print_hr()
|
||||
{
|
||||
local cols="${COLUMNS:-}"
|
||||
@@ -364,6 +367,7 @@ mdcat()
|
||||
fi
|
||||
}
|
||||
|
||||
local _mdcat_print_code_block
|
||||
_mdcat_print_code_block()
|
||||
{
|
||||
local lang="$1"
|
||||
@@ -422,14 +426,11 @@ mdcat()
|
||||
printf "%b%s%b\n" "$frame_on" "$border" "$off"
|
||||
}
|
||||
|
||||
local _mdcat_print_table
|
||||
# That function is a bit slow, we need to try to optimize it
|
||||
_mdcat_print_table()
|
||||
{
|
||||
local -a lines=("$@")
|
||||
local -a table_rows=()
|
||||
local -a col_widths=()
|
||||
local i j ncols=0
|
||||
local sep=$'\x1f'
|
||||
|
||||
local _mdcat_parse_table_row
|
||||
_mdcat_parse_table_row()
|
||||
{
|
||||
local input="$1"
|
||||
@@ -466,6 +467,12 @@ mdcat()
|
||||
printf '%s' "$joined"
|
||||
}
|
||||
|
||||
local -a lines=("$@")
|
||||
local -a table_rows=()
|
||||
local -a col_widths=()
|
||||
local i j ncols=0
|
||||
local sep=$'\x1f'
|
||||
|
||||
# Parse header and data rows, skipping the Markdown separator row.
|
||||
# Width is computed from visible text length with ANSI escapes stripped.
|
||||
for ((i=0; i<${#lines[@]}; ++i)); do
|
||||
|
||||
@@ -286,6 +286,7 @@ function timer_stop
|
||||
# command, the elapsed time of the last command, and the current user and host.
|
||||
set_prompt()
|
||||
{
|
||||
local _prompt_git_segment
|
||||
_prompt_git_segment()
|
||||
{
|
||||
# Fast path: skip git lookup when feature is disabled.
|
||||
@@ -316,6 +317,7 @@ set_prompt()
|
||||
printf "%s" "git:${branch}${dirty}${sync}"
|
||||
}
|
||||
|
||||
local _prompt_conda_env
|
||||
_prompt_conda_env()
|
||||
{
|
||||
[[ "${PROMPT_SHOW_CONDA:-1}" == "0" ]] && return 0
|
||||
@@ -323,6 +325,7 @@ set_prompt()
|
||||
printf "%s" "conda:${CONDA_DEFAULT_ENV}"
|
||||
}
|
||||
|
||||
local _prompt_venv_env
|
||||
_prompt_venv_env()
|
||||
{
|
||||
[[ "${PROMPT_SHOW_VENV:-1}" == "0" ]] && return 0
|
||||
@@ -331,6 +334,7 @@ set_prompt()
|
||||
printf "%s" "venv:${VIRTUAL_ENV##*/}"
|
||||
}
|
||||
|
||||
local _prompt_session_markers
|
||||
_prompt_session_markers()
|
||||
{
|
||||
[[ "${PROMPT_SHOW_SESSION:-1}" == "0" ]] && return 0
|
||||
|
||||
@@ -152,6 +152,7 @@ _rain_engine()
|
||||
local term_area=0
|
||||
local frame_sleep="$step_duration"
|
||||
|
||||
local sigwinch
|
||||
sigwinch()
|
||||
{
|
||||
term_width=$(tput cols)
|
||||
@@ -193,11 +194,13 @@ _rain_engine()
|
||||
fi
|
||||
}
|
||||
|
||||
local do_exit
|
||||
do_exit()
|
||||
{
|
||||
exit_st=1
|
||||
}
|
||||
|
||||
local do_render
|
||||
do_render()
|
||||
{
|
||||
local idx=0 y=0 drop_color="" current_char="" render_color=""
|
||||
@@ -293,6 +296,7 @@ _rain_engine()
|
||||
# Usage: rain [OPTIONS]
|
||||
rain()
|
||||
{
|
||||
local _rain_show_usage
|
||||
_rain_show_usage()
|
||||
{
|
||||
printf "Usage: rain [OPTIONS]\n"
|
||||
@@ -389,6 +393,7 @@ export -f rain
|
||||
# Usage: matrix [OPTIONS]
|
||||
matrix()
|
||||
{
|
||||
local _matrix_show_usage
|
||||
_matrix_show_usage()
|
||||
{
|
||||
printf "Usage: matrix [OPTIONS]\n"
|
||||
|
||||
Reference in New Issue
Block a user