Fix all Shellcheck SC2034 violations.

pull/143/head
Ben Peachey 3 years ago committed by Joseph Werle
parent a53a6648cc
commit 28b14b9fdd

@ -24,7 +24,9 @@ usage () {
## commands
commands () {
{
declare -a local cmds=( $(
local cmds
declare -a cmds=( $(
bpkg-suggest 'bpkg-' |
tail -n+2 |
sed 's/.*\/bpkg-//g' |
@ -38,7 +40,8 @@ commands () {
## feature tests
features () {
declare -a local features=(bpkg-json bpkg-suggest)
local features
declare -a features=(bpkg-json bpkg-suggest)
for ((i = 0; i < ${#features[@]}; ++i)); do
local f="${features[$i]}"
if ! type "${f}" > /dev/null 2>&1; then
@ -88,7 +91,8 @@ bpkg () {
else
echo >&2 "error: \`${arg}' is not a bpkg command."
{
declare -a local res=($(commands))
local res
declare -a res=($(commands))
if [ -n "${res}" ]; then
echo

@ -101,6 +101,7 @@ options () {
}
set_global () {
# shellcheck disable=SC2034
GLOBAL=1
}

@ -226,10 +226,12 @@ bpkg_install_from_remote () {
local version=''
local auth_param=''
local let has_pkg_json=0
declare -a local pkg_parts=()
declare -a local remote_parts=()
declare -a local scripts=()
declare -a local files=()
local files pkg_parts remote_parts scripts
declare -a pkg_parts=()
declare -a remote_parts=()
declare -a scripts=()
declare -a files=()
## get version if available
{
@ -472,10 +474,7 @@ bpkg_install_from_remote () {
## grab each file and place in correct directory
for file in "${files[@]}"; do
(
local filename
if [[ "${file}" ]];then
filename="$(echo "${file}" | xargs basename )"
info "fetch" "${url}/${file}"
info "write" "${cwd}/deps/${name}/${file}"
save_remote_file "${url}/${file}" "${cwd}/deps/${name}/${file}" "${auth_param}"

@ -10,9 +10,10 @@ usage () {
## main
suggest () {
declare -a local paths=()
declare -a local seen=()
declare -a local found=()
local found paths seen
declare -a paths=()
declare -a seen=()
declare -a found=()
local query="${1}"
case "${query}" in

@ -93,6 +93,7 @@ bpkg_select_remote () {
local git_remote=$2
BPKG_REMOTE_HOST=$(echo "$git_remote" | sed 's/.*:\/\///' | sed 's/\/$//' | tr '/' '_')
BPKG_REMOTE_INDEX="$BPKG_INDEX/$BPKG_REMOTE_HOST"
# shellcheck disable=SC2034
BPKG_REMOTE_INDEX_FILE="$BPKG_REMOTE_INDEX/index.txt"
BPKG_OAUTH_TOKEN=""
BPKG_CURL_AUTH_PARAM=""
@ -104,9 +105,11 @@ bpkg_select_remote () {
local remote_parts=($remote)
IFS="${OLDIFS}"
BPKG_OAUTH_TOKEN=${remote_parts[1]}
# shellcheck disable=SC2034
BPKG_CURL_AUTH_PARAM="-u $BPKG_OAUTH_TOKEN:x-oauth-basic"
BPKG_REMOTE=${remote_parts[2]}
if [[ "$git_remote" == https://* ]] && [[ "$git_remote" != *x-oauth-basic* ]] && [[ "$git_remote" != *${BPKG_OAUTH_TOKEN}* ]]; then
# shellcheck disable=SC2034
BPKG_AUTH_GIT_REMOTE=${git_remote/https:\/\//https:\/\/$BPKG_OAUTH_TOKEN:x-oauth-basic@}
fi
else
@ -122,6 +125,7 @@ bpkg_select_raw_path() {
if [ "$BPKG_OAUTH_TOKEN" == "" ]; then
BPKG_RAW_PATH="$BPKG_REMOTE/$user/$name"
else
# shellcheck disable=SC2034
BPKG_RAW_PATH="$BPKG_REMOTE/$user/$name/raw"
fi
return 0

Loading…
Cancel
Save