fix/document all shellcheck warnings
This commit is contained in:
parent
1bd1c80a5a
commit
1fbfc141ee
11
etools
11
etools
@ -22,6 +22,7 @@ function etools_smart_find() {
|
|||||||
eerror "no valid repository name" && return 2;
|
eerror "no valid repository name" && return 2;
|
||||||
. ./helper.sh
|
. ./helper.sh
|
||||||
if [[ "${2}" == /* ]]; then
|
if [[ "${2}" == /* ]]; then
|
||||||
|
# rely on word splitting for all of these
|
||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
_most_probable "$1" $(_filter $(_formatted_find "$@"))
|
_most_probable "$1" $(_filter $(_formatted_find "$@"))
|
||||||
else
|
else
|
||||||
@ -42,9 +43,11 @@ function etools_smart_find() {
|
|||||||
# NOTE: get latest enabled version for a given package name
|
# NOTE: get latest enabled version for a given package name
|
||||||
function etools_get_version() {
|
function etools_get_version() {
|
||||||
[ -z "$1" ] && eerror "Pass a package name to this function" "\n" && return 2;
|
[ -z "$1" ] && eerror "Pass a package name to this function" "\n" && return 2;
|
||||||
[ ! -d ${ETOOLS_REPO_PATH}/*/$1 ] && \
|
# in this case globs work with -d
|
||||||
|
# shellcheck disable=SC2144
|
||||||
|
[ ! -d "${ETOOLS_REPO_PATH}"/*/"$1" ] && \
|
||||||
[ "$ETOOLS_DEBUG" ] && einfo "checked path ${ETOOLS_REPO_PATH}/*/$1" "\n" && \
|
[ "$ETOOLS_DEBUG" ] && einfo "checked path ${ETOOLS_REPO_PATH}/*/$1" "\n" && \
|
||||||
[ ! -d /var/db/repos/*/$1 ] && \
|
[ ! -d /var/db/repos/*/"$1" ] && \
|
||||||
[ "$ETOOLS_DEBUG" ] && einfo "checked path /var/db/repos/*/$1" "\n" && \
|
[ "$ETOOLS_DEBUG" ] && einfo "checked path /var/db/repos/*/$1" "\n" && \
|
||||||
eerror "Pass a package name to this function" "\n" && \
|
eerror "Pass a package name to this function" "\n" && \
|
||||||
return 2;
|
return 2;
|
||||||
@ -52,7 +55,9 @@ function etools_get_version() {
|
|||||||
local latest=:
|
local latest=:
|
||||||
. ./helper.sh
|
. ./helper.sh
|
||||||
[ "$ETOOLS_CHECK_LIVE" ] && if _matches_live "$1"; then
|
[ "$ETOOLS_CHECK_LIVE" ] && if _matches_live "$1"; then
|
||||||
latest="$(ls -1vr ${ETOOLS_REPO_PATH:-/var/db/repos}/*/$1/*9999*.ebuild | head "-${2:-1}" 2>/dev/null)"
|
# use ls over find for simplicity
|
||||||
|
# shellcheck disable=SC2012
|
||||||
|
latest="$(ls -1vr "${ETOOLS_REPO_PATH:-/var/db/repos}"/*/"$1"/*9999*.ebuild | head "-${2:-1}" 2>/dev/null)"
|
||||||
[ -n "$latest" ] && _extract_version "$latest" && ./helper.sh && return 0;
|
[ -n "$latest" ] && _extract_version "$latest" && ./helper.sh && return 0;
|
||||||
fi
|
fi
|
||||||
if [ "$ETOOLS_CHECK_TESTING" ]; then
|
if [ "$ETOOLS_CHECK_TESTING" ]; then
|
||||||
|
|||||||
@ -183,9 +183,13 @@ function _matches_testing() {
|
|||||||
function _get_latest() {
|
function _get_latest() {
|
||||||
local offset=$2
|
local offset=$2
|
||||||
local latest=:
|
local latest=:
|
||||||
shopt -s globstar nullglob
|
# shopt -s globstar nullglob
|
||||||
for ebuild in $(ls -1vr /var/db/repos/*/$1/*.ebuild); do
|
# use ls for simplicity
|
||||||
|
# shellcheck disable=SC2045
|
||||||
|
for ebuild in $(ls -1vr /var/db/repos/*/"$1"/*.ebuild); do
|
||||||
if [[ ! "$ebuild" == *"9999"* ]]; then
|
if [[ ! "$ebuild" == *"9999"* ]]; then
|
||||||
|
# we can't specify the source for this
|
||||||
|
# shellcheck disable=SC1090
|
||||||
. "$ebuild" >>/dev/null 2>/dev/null
|
. "$ebuild" >>/dev/null 2>/dev/null
|
||||||
if [[ "$KEYWORDS" == *"$3"* ]]; then
|
if [[ "$KEYWORDS" == *"$3"* ]]; then
|
||||||
latest="$ebuild"
|
latest="$ebuild"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user