Trivial fixes for shellcheck warnings
This commit is contained in:
parent
595a53ad3b
commit
31710b7045
@ -144,7 +144,7 @@ fi
|
|||||||
pkill -f "${program_}"
|
pkill -f "${program_}"
|
||||||
|
|
||||||
# start youtube download in stream mode (-o -) into temporary file
|
# start youtube download in stream mode (-o -) into temporary file
|
||||||
youtube-dl -qo - "$1" > ${file_to_cast} &
|
youtube-dl -qo - "$1" > "${file_to_cast}" &
|
||||||
ytdl_pid=$!
|
ytdl_pid=$!
|
||||||
|
|
||||||
msg info "Casting $1" >> "$QUTE_FIFO"
|
msg info "Casting $1" >> "$QUTE_FIFO"
|
||||||
@ -153,4 +153,4 @@ tail -F "${file_to_cast}" | ${program_} -
|
|||||||
|
|
||||||
# cleanup remaining background process and file on disk
|
# cleanup remaining background process and file on disk
|
||||||
kill ${ytdl_pid}
|
kill ${ytdl_pid}
|
||||||
rm -rf ${tmpdir}
|
rm -rf "${tmpdir}"
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
[ -z "$QUTE_URL" ] && QUTE_URL='http://google.com'
|
[ -z "$QUTE_URL" ] && QUTE_URL='http://google.com'
|
||||||
|
|
||||||
url=$(echo "$QUTE_URL" | cat - "$QUTE_CONFIG_DIR/quickmarks" "$QUTE_DATA_DIR/history" | dmenu -l 15 -p qutebrowser)
|
url=$(echo "$QUTE_URL" | cat - "$QUTE_CONFIG_DIR/quickmarks" "$QUTE_DATA_DIR/history" | dmenu -l 15 -p qutebrowser)
|
||||||
url=$(echo "$url" | sed -E 's/[^ ]+ +//g' | egrep "https?:" || echo "$url")
|
url=$(echo "$url" | sed -E 's/[^ ]+ +//g' | grep -E "https?:" || echo "$url")
|
||||||
|
|
||||||
[ -z "${url// }" ] && exit
|
[ -z "${url// }" ] && exit
|
||||||
|
|
||||||
|
@ -35,12 +35,12 @@ FILE_SIZE=$(ls -s --block-size=1048576 "$QUTE_TEXT" | cut -d' ' -f1)
|
|||||||
|
|
||||||
# use pygments to pretty-up the json (syntax highlight) if file is less than 10MB
|
# use pygments to pretty-up the json (syntax highlight) if file is less than 10MB
|
||||||
if [ "$FILE_SIZE" -lt "10" ]; then
|
if [ "$FILE_SIZE" -lt "10" ]; then
|
||||||
FORMATTED_JSON="$(echo "$FORMATTED_JSON" | pygmentize -l json -f html -O full,style=$STYLE)"
|
FORMATTED_JSON="$(echo "$FORMATTED_JSON" | pygmentize -l json -f html -O full,style="$STYLE")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create a temp file and write the formatted json to that file
|
# create a temp file and write the formatted json to that file
|
||||||
TEMP_FILE="$(mktemp --suffix '.html')"
|
TEMP_FILE="$(mktemp --suffix '.html')"
|
||||||
echo "$FORMATTED_JSON" > $TEMP_FILE
|
echo "$FORMATTED_JSON" > "$TEMP_FILE"
|
||||||
|
|
||||||
|
|
||||||
# send the command to qutebrowser to open the new file containing the formatted json
|
# send the command to qutebrowser to open the new file containing the formatted json
|
||||||
|
@ -92,7 +92,7 @@ if [ "${#entries[@]}" -eq 0 ] ; then
|
|||||||
die "Download directory »${DOWNLOAD_DIR}« empty"
|
die "Download directory »${DOWNLOAD_DIR}« empty"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
line=$(printf "%s\n" "${entries[@]}" \
|
line=$(printf '%s\n' "${entries[@]}" \
|
||||||
| crop-first-column 55 \
|
| crop-first-column 55 \
|
||||||
| column -s $'\t' -t \
|
| column -s $'\t' -t \
|
||||||
| $ROFI_CMD "${rofi_default_args[@]}" "$ROFI_ARGS") || true
|
| $ROFI_CMD "${rofi_default_args[@]}" "$ROFI_ARGS") || true
|
||||||
|
@ -178,7 +178,7 @@ choose_entry_menu() {
|
|||||||
if [ "$nr" -eq 1 ] && ! ((menu_if_one_entry)) ; then
|
if [ "$nr" -eq 1 ] && ! ((menu_if_one_entry)) ; then
|
||||||
file="${files[0]}"
|
file="${files[0]}"
|
||||||
else
|
else
|
||||||
file=$( printf "%s\n" "${files[@]}" | "${MENU_COMMAND[@]}" )
|
file=$( printf '%s\n' "${files[@]}" | "${MENU_COMMAND[@]}" )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,6 +303,7 @@ pass_backend
|
|||||||
QUTE_CONFIG_DIR=${QUTE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/qutebrowser/}
|
QUTE_CONFIG_DIR=${QUTE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/qutebrowser/}
|
||||||
PWFILL_CONFIG=${PWFILL_CONFIG:-${QUTE_CONFIG_DIR}/password_fill_rc}
|
PWFILL_CONFIG=${PWFILL_CONFIG:-${QUTE_CONFIG_DIR}/password_fill_rc}
|
||||||
if [ -f "$PWFILL_CONFIG" ] ; then
|
if [ -f "$PWFILL_CONFIG" ] ; then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source "$PWFILL_CONFIG"
|
source "$PWFILL_CONFIG"
|
||||||
fi
|
fi
|
||||||
init
|
init
|
||||||
@ -311,7 +312,7 @@ simplify_url "$QUTE_URL"
|
|||||||
query_entries "${simple_url}"
|
query_entries "${simple_url}"
|
||||||
no_entries_found
|
no_entries_found
|
||||||
# remove duplicates
|
# remove duplicates
|
||||||
mapfile -t files < <(printf "%s\n" "${files[@]}" | sort | uniq )
|
mapfile -t files < <(printf '%s\n' "${files[@]}" | sort | uniq )
|
||||||
choose_entry
|
choose_entry
|
||||||
if [ -z "$file" ] ; then
|
if [ -z "$file" ] ; then
|
||||||
# choose_entry didn't want any of these entries
|
# choose_entry didn't want any of these entries
|
||||||
|
@ -39,6 +39,7 @@ get_selection() {
|
|||||||
|
|
||||||
[[ $font ]] && opts+=(-fn "$font")
|
[[ $font ]] && opts+=(-fn "$font")
|
||||||
|
|
||||||
|
# shellcheck source=/dev/null
|
||||||
[[ -s $optsfile ]] && source "$optsfile"
|
[[ -s $optsfile ]] && source "$optsfile"
|
||||||
|
|
||||||
url=$(get_selection)
|
url=$(get_selection)
|
||||||
|
@ -32,7 +32,7 @@ add_feed () {
|
|||||||
if grep -Fq "$1" "feeds"; then
|
if grep -Fq "$1" "feeds"; then
|
||||||
notice "$1 is saved already."
|
notice "$1 is saved already."
|
||||||
else
|
else
|
||||||
printf "%s\n" "$1" >> "feeds"
|
printf '%s\n' "$1" >> "feeds"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ notice () {
|
|||||||
|
|
||||||
# Update a database of a feed and open new URLs
|
# Update a database of a feed and open new URLs
|
||||||
read_items () {
|
read_items () {
|
||||||
cd read_urls
|
cd read_urls || return
|
||||||
feed_file="$(echo "$1" | tr -d /)"
|
feed_file="$(echo "$1" | tr -d /)"
|
||||||
feed_temp_file="$(mktemp "$feed_file.tmp.XXXXXXXXXX")"
|
feed_temp_file="$(mktemp "$feed_file.tmp.XXXXXXXXXX")"
|
||||||
feed_new_items="$(mktemp "$feed_file.new.XXXXXXXXXX")"
|
feed_new_items="$(mktemp "$feed_file.new.XXXXXXXXXX")"
|
||||||
@ -75,7 +75,7 @@ read_items () {
|
|||||||
cat "$feed_new_items" >> "$feed_file"
|
cat "$feed_new_items" >> "$feed_file"
|
||||||
sort -o "$feed_file" "$feed_file"
|
sort -o "$feed_file" "$feed_file"
|
||||||
rm "$feed_temp_file" "$feed_new_items"
|
rm "$feed_temp_file" "$feed_new_items"
|
||||||
fi | while read item; do
|
fi | while read -r item; do
|
||||||
echo "open -t $item" > "$QUTE_FIFO"
|
echo "open -t $item" > "$QUTE_FIFO"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ if [ ! -d "$config_dir/read_urls" ]; then
|
|||||||
mkdir -p "$config_dir/read_urls"
|
mkdir -p "$config_dir/read_urls"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$config_dir"
|
cd "$config_dir" || exit
|
||||||
|
|
||||||
if [ $# != 0 ]; then
|
if [ $# != 0 ]; then
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
@ -115,7 +115,7 @@ if < /dev/null grep --help 2>&1 | grep -q -- -a; then
|
|||||||
text_only="-a"
|
text_only="-a"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while read feed_url; do
|
while read -r feed_url; do
|
||||||
read_items "$feed_url" &
|
read_items "$feed_url" &
|
||||||
done < "$config_dir/feeds"
|
done < "$config_dir/feeds"
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
case $TESTENV in
|
case $TESTENV in
|
||||||
py3*-pyqt*)
|
py3*-pyqt*)
|
||||||
exe=$(readlink -f .tox/$TESTENV/bin/python)
|
exe=$(readlink -f ".tox/$TESTENV/bin/python")
|
||||||
full=
|
full=
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -21,13 +21,13 @@
|
|||||||
# Stolen from https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh
|
# Stolen from https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh
|
||||||
# and adjusted to use ((...))
|
# and adjusted to use ((...))
|
||||||
travis_retry() {
|
travis_retry() {
|
||||||
local ANSI_RED="\033[31;1m"
|
local ANSI_RED='\033[31;1m'
|
||||||
local ANSI_RESET="\033[0m"
|
local ANSI_RESET='\033[0m'
|
||||||
local result=0
|
local result=0
|
||||||
local count=1
|
local count=1
|
||||||
while (( count < 3 )); do
|
while (( count < 3 )); do
|
||||||
if (( result != 0 )); then
|
if (( result != 0 )); then
|
||||||
echo -e "\n${ANSI_RED}The command \"$*\" failed. Retrying, $count of 3.${ANSI_RESET}\n" >&2
|
echo -e "\\n${ANSI_RED}The command \"$*\" failed. Retrying, $count of 3.${ANSI_RESET}\\n" >&2
|
||||||
fi
|
fi
|
||||||
"$@"
|
"$@"
|
||||||
result=$?
|
result=$?
|
||||||
@ -37,7 +37,7 @@ travis_retry() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
if (( count > 3 )); then
|
if (( count > 3 )); then
|
||||||
echo -e "\n${ANSI_RED}The command \"$*\" failed 3 times.${ANSI_RESET}\n" >&2
|
echo -e "\\n${ANSI_RED}The command \"$*\" failed 3 times.${ANSI_RESET}\\n" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return $result
|
return $result
|
||||||
|
@ -11,7 +11,7 @@ if [[ $# != 1 ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$tmpdir"
|
cd "$tmpdir" || exit
|
||||||
mkdir windows
|
mkdir windows
|
||||||
|
|
||||||
base="https://github.com/qutebrowser/qutebrowser/releases/download/v$1"
|
base="https://github.com/qutebrowser/qutebrowser/releases/download/v$1"
|
||||||
@ -21,13 +21,13 @@ wget "$base/qutebrowser-$1.tar.gz.asc" || exit 1
|
|||||||
wget "$base/qutebrowser-$1.dmg" || exit 1
|
wget "$base/qutebrowser-$1.dmg" || exit 1
|
||||||
wget "$base/qutebrowser_${1}-1_all.deb" || exit 1
|
wget "$base/qutebrowser_${1}-1_all.deb" || exit 1
|
||||||
|
|
||||||
cd windows
|
cd windows || exit
|
||||||
wget "$base/qutebrowser-${1}-amd64.msi" || exit 1
|
wget "$base/qutebrowser-${1}-amd64.msi" || exit 1
|
||||||
wget "$base/qutebrowser-${1}-win32.msi" || exit 1
|
wget "$base/qutebrowser-${1}-win32.msi" || exit 1
|
||||||
wget "$base/qutebrowser-${1}-windows-standalone-amd64.zip" || exit 1
|
wget "$base/qutebrowser-${1}-windows-standalone-amd64.zip" || exit 1
|
||||||
wget "$base/qutebrowser-${1}-windows-standalone-win32.zip" || exit 1
|
wget "$base/qutebrowser-${1}-windows-standalone-win32.zip" || exit 1
|
||||||
|
|
||||||
dest="/srv/http/qutebrowser/releases/v$1"
|
dest="/srv/http/qutebrowser/releases/v$1"
|
||||||
cd "$oldpwd"
|
cd "$oldpwd" || exit
|
||||||
sudo mv "$tmpdir" "$dest"
|
sudo mv "$tmpdir" "$dest"
|
||||||
sudo chown -R http:http "$dest"
|
sudo chown -R http:http "$dest"
|
||||||
|
Loading…
Reference in New Issue
Block a user