Merge remote-tracking branch 'origin/pr/3355'
This commit is contained in:
commit
e97fbfdf56
@ -52,6 +52,10 @@ matrix:
|
||||
language: node_js
|
||||
python: null
|
||||
node_js: "lts/*"
|
||||
- os: linux
|
||||
language: generic
|
||||
env: TESTENV=shellcheck
|
||||
services: docker
|
||||
fast_finish: true
|
||||
|
||||
cache:
|
||||
|
@ -144,7 +144,7 @@ fi
|
||||
pkill -f "${program_}"
|
||||
|
||||
# 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=$!
|
||||
|
||||
msg info "Casting $1" >> "$QUTE_FIFO"
|
||||
@ -153,4 +153,4 @@ tail -F "${file_to_cast}" | ${program_} -
|
||||
|
||||
# cleanup remaining background process and file on disk
|
||||
kill ${ytdl_pid}
|
||||
rm -rf ${tmpdir}
|
||||
rm -rf "${tmpdir}"
|
||||
|
@ -41,7 +41,7 @@
|
||||
[ -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 "$url" | sed -E 's/[^ ]+ +//g' | egrep "https?:" || echo "$url")
|
||||
url=$(echo "$url" | sed -E 's/[^ ]+ +//g' | grep -E "https?:" || echo "$url")
|
||||
|
||||
[ -z "${url// }" ] && exit
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
set -euo pipefail
|
||||
#
|
||||
# Behavior:
|
||||
# Userscript for qutebrowser which will take the raw JSON text of the current
|
||||
@ -19,29 +20,23 @@
|
||||
#
|
||||
# Bryan Gilbert, 2017
|
||||
|
||||
# do not run pygmentize on files larger than this amount of bytes
|
||||
MAX_SIZE_PRETTIFY=10485760 # 10 MB
|
||||
# default style to monokai if none is provided
|
||||
STYLE=${1:-monokai}
|
||||
# format json using jq
|
||||
FORMATTED_JSON="$(cat "$QUTE_TEXT" | jq '.')"
|
||||
|
||||
# if jq command failed or formatted json is empty, assume failure and terminate
|
||||
if [ $? -ne 0 ] || [ -z "$FORMATTED_JSON" ]; then
|
||||
echo "Invalid json, aborting..."
|
||||
exit 1
|
||||
TEMP_FILE="$(mktemp)"
|
||||
jq . "$QUTE_TEXT" >"$TEMP_FILE"
|
||||
|
||||
# try GNU stat first and then OSX stat if the former fails
|
||||
FILE_SIZE=$(
|
||||
stat --printf="%s" "$TEMP_FILE" 2>/dev/null ||
|
||||
stat -f%z "$TEMP_FILE" 2>/dev/null
|
||||
)
|
||||
if [ "$FILE_SIZE" -lt "$MAX_SIZE_PRETTIFY" ]; then
|
||||
pygmentize -l json -f html -O full,style="$STYLE" <"$TEMP_FILE" >"${TEMP_FILE}_"
|
||||
mv -f "${TEMP_FILE}_" "$TEMP_FILE"
|
||||
fi
|
||||
|
||||
# calculate the filesize of the json document
|
||||
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
|
||||
if [ "$FILE_SIZE" -lt "10" ]; then
|
||||
FORMATTED_JSON="$(echo "$FORMATTED_JSON" | pygmentize -l json -f html -O full,style=$STYLE)"
|
||||
fi
|
||||
|
||||
# create a temp file and write the formatted json to that file
|
||||
TEMP_FILE="$(mktemp --suffix '.html')"
|
||||
echo "$FORMATTED_JSON" > $TEMP_FILE
|
||||
|
||||
|
||||
# send the command to qutebrowser to open the new file containing the formatted json
|
||||
echo "open -t file://$TEMP_FILE" >> "$QUTE_FIFO"
|
||||
|
@ -76,6 +76,7 @@ crop-first-column() {
|
||||
ls-files() {
|
||||
# add the slash at the end of the download dir enforces to follow the
|
||||
# symlink, if the DOWNLOAD_DIR itself is a symlink
|
||||
# shellcheck disable=SC2010
|
||||
ls -Q --quoting-style escape -h -o -1 -A -t "${DOWNLOAD_DIR}/" \
|
||||
| grep '^[-]' \
|
||||
| cut -d' ' -f3- \
|
||||
@ -91,10 +92,10 @@ if [ "${#entries[@]}" -eq 0 ] ; then
|
||||
die "Download directory »${DOWNLOAD_DIR}« empty"
|
||||
fi
|
||||
|
||||
line=$(printf "%s\n" "${entries[@]}" \
|
||||
line=$(printf '%s\n' "${entries[@]}" \
|
||||
| crop-first-column 55 \
|
||||
| column -s $'\t' -t \
|
||||
| $ROFI_CMD "${rofi_default_args[@]}" $ROFI_ARGS) || true
|
||||
| $ROFI_CMD "${rofi_default_args[@]}" "$ROFI_ARGS") || true
|
||||
if [ -z "$line" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
@ -64,7 +64,7 @@ die() {
|
||||
javascript_escape() {
|
||||
# print the first argument in an escaped way, such that it can safely
|
||||
# be used within javascripts double quotes
|
||||
sed "s,[\\\'\"],\\\&,g" <<< "$1"
|
||||
sed "s,[\\\\'\"],\\\\&,g" <<< "$1"
|
||||
}
|
||||
|
||||
# ======================================================= #
|
||||
@ -178,7 +178,7 @@ choose_entry_menu() {
|
||||
if [ "$nr" -eq 1 ] && ! ((menu_if_one_entry)) ; then
|
||||
file="${files[0]}"
|
||||
else
|
||||
file=$( printf "%s\n" "${files[@]}" | "${MENU_COMMAND[@]}" )
|
||||
file=$( printf '%s\n' "${files[@]}" | "${MENU_COMMAND[@]}" )
|
||||
fi
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ pass_backend() {
|
||||
if ((match_line)) ; then
|
||||
# add entries with matching URL-tag
|
||||
while read -r -d "" passfile ; do
|
||||
if $GPG "${GPG_OPTS}" -d "$passfile" \
|
||||
if $GPG "${GPG_OPTS[@]}" -d "$passfile" \
|
||||
| grep --max-count=1 -iE "${match_line_pattern}${url}" > /dev/null
|
||||
then
|
||||
passfile="${passfile#$PREFIX}"
|
||||
@ -269,7 +269,7 @@ pass_backend() {
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done < <($GPG "${GPG_OPTS}" -d "$path" )
|
||||
done < <($GPG "${GPG_OPTS[@]}" -d "$path" )
|
||||
}
|
||||
}
|
||||
# =======================================================
|
||||
@ -283,7 +283,7 @@ secret_backend() {
|
||||
query_entries() {
|
||||
local domain="$1"
|
||||
while read -r line ; do
|
||||
if [[ "$line" =~ "attribute.username = " ]] ; then
|
||||
if [[ "$line" == "attribute.username ="* ]] ; then
|
||||
files+=("$domain ${line#${BASH_REMATCH[0]}}")
|
||||
fi
|
||||
done < <( secret-tool search --unlock --all domain "$domain" 2>&1 )
|
||||
@ -303,6 +303,7 @@ pass_backend
|
||||
QUTE_CONFIG_DIR=${QUTE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/qutebrowser/}
|
||||
PWFILL_CONFIG=${PWFILL_CONFIG:-${QUTE_CONFIG_DIR}/password_fill_rc}
|
||||
if [ -f "$PWFILL_CONFIG" ] ; then
|
||||
# shellcheck source=/dev/null
|
||||
source "$PWFILL_CONFIG"
|
||||
fi
|
||||
init
|
||||
@ -311,7 +312,7 @@ simplify_url "$QUTE_URL"
|
||||
query_entries "${simple_url}"
|
||||
no_entries_found
|
||||
# remove duplicates
|
||||
mapfile -t files < <(printf "%s\n" "${files[@]}" | sort | uniq )
|
||||
mapfile -t files < <(printf '%s\n' "${files[@]}" | sort | uniq )
|
||||
choose_entry
|
||||
if [ -z "$file" ] ; then
|
||||
# choose_entry didn't want any of these entries
|
||||
|
@ -35,17 +35,12 @@ get_selection() {
|
||||
|
||||
# Main
|
||||
# https://github.com/halfwit/dotfiles/blob/master/.config/dmenu/font
|
||||
if [[ -s $confdir/dmenu/font ]]; then
|
||||
read -r font < "$confdir"/dmenu/font
|
||||
fi
|
||||
[[ -s $confdir/dmenu/font ]] && read -r font < "$confdir"/dmenu/font
|
||||
|
||||
if [[ $font ]]; then
|
||||
opts+=(-fn "$font")
|
||||
fi
|
||||
[[ $font ]] && opts+=(-fn "$font")
|
||||
|
||||
if [[ -s $optsfile ]]; then
|
||||
source "$optsfile"
|
||||
fi
|
||||
# shellcheck source=/dev/null
|
||||
[[ -s $optsfile ]] && source "$optsfile"
|
||||
|
||||
url=$(get_selection)
|
||||
url=${url/*http/http}
|
||||
|
@ -32,7 +32,7 @@ add_feed () {
|
||||
if grep -Fq "$1" "feeds"; then
|
||||
notice "$1 is saved already."
|
||||
else
|
||||
printf "%s\n" "$1" >> "feeds"
|
||||
printf '%s\n' "$1" >> "feeds"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ notice () {
|
||||
|
||||
# Update a database of a feed and open new URLs
|
||||
read_items () {
|
||||
cd read_urls
|
||||
cd read_urls || return 1
|
||||
feed_file="$(echo "$1" | tr -d /)"
|
||||
feed_temp_file="$(mktemp "$feed_file.tmp.XXXXXXXXXX")"
|
||||
feed_new_items="$(mktemp "$feed_file.new.XXXXXXXXXX")"
|
||||
@ -75,7 +75,7 @@ read_items () {
|
||||
cat "$feed_new_items" >> "$feed_file"
|
||||
sort -o "$feed_file" "$feed_file"
|
||||
rm "$feed_temp_file" "$feed_new_items"
|
||||
fi | while read item; do
|
||||
fi | while read -r item; do
|
||||
echo "open -t $item" > "$QUTE_FIFO"
|
||||
done
|
||||
}
|
||||
@ -85,7 +85,7 @@ if [ ! -d "$config_dir/read_urls" ]; then
|
||||
mkdir -p "$config_dir/read_urls"
|
||||
fi
|
||||
|
||||
cd "$config_dir"
|
||||
cd "$config_dir" || exit 1
|
||||
|
||||
if [ $# != 0 ]; then
|
||||
for arg in "$@"; do
|
||||
@ -115,7 +115,7 @@ if < /dev/null grep --help 2>&1 | grep -q -- -a; then
|
||||
text_only="-a"
|
||||
fi
|
||||
|
||||
while read feed_url; do
|
||||
while read -r feed_url; do
|
||||
read_items "$feed_url" &
|
||||
done < "$config_dir/feeds"
|
||||
|
||||
|
@ -25,12 +25,10 @@
|
||||
[[ $QUTE_MODE == 'hints' ]] && title=$QUTE_SELECTED_TEXT || title=$QUTE_TITLE
|
||||
|
||||
# try to add the task and grab the output
|
||||
msg="$(task add $title $@ 2>&1)"
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
if msg="$(task add "$title" "$*" 2>&1)"; then
|
||||
# annotate the new task with the url, send the output back to the browser
|
||||
task +LATEST annotate "$QUTE_URL"
|
||||
echo "message-info '$msg'" >> $QUTE_FIFO
|
||||
echo "message-info '$msg'" >> "$QUTE_FIFO"
|
||||
else
|
||||
echo "message-error '$msg'" >> $QUTE_FIFO
|
||||
echo "message-error '$msg'" >> "$QUTE_FIFO"
|
||||
fi
|
||||
|
@ -50,7 +50,7 @@ msg() {
|
||||
MPV_COMMAND=${MPV_COMMAND:-mpv}
|
||||
# Warning: spaces in single flags are not supported
|
||||
MPV_FLAGS=${MPV_FLAGS:- --force-window --no-terminal --keep-open=yes --ytdl --ytdl-raw-options=yes-playlist=}
|
||||
video_command=( "$MPV_COMMAND" $MPV_FLAGS )
|
||||
IFS=" " read -r -a video_command <<< "$MPV_COMMAND $MPV_FLAGS"
|
||||
|
||||
js() {
|
||||
cat <<EOF
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
case $TESTENV in
|
||||
py3*-pyqt*)
|
||||
exe=$(readlink -f .tox/$TESTENV/bin/python)
|
||||
exe=$(readlink -f ".tox/$TESTENV/bin/python")
|
||||
full=
|
||||
;;
|
||||
*)
|
||||
@ -15,4 +15,4 @@ case $TESTENV in
|
||||
;;
|
||||
esac
|
||||
|
||||
find . -name *.core -o -name core -exec gdb --batch --quiet -ex "thread apply all bt $full" "$exe" {} \;
|
||||
find . \( -name "*.core" -o -name core \) -exec gdb --batch --quiet -ex "thread apply all bt $full" "$exe" {} \;
|
||||
|
@ -21,23 +21,23 @@
|
||||
# Stolen from https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh
|
||||
# and adjusted to use ((...))
|
||||
travis_retry() {
|
||||
local ANSI_RED="\033[31;1m"
|
||||
local ANSI_RESET="\033[0m"
|
||||
local ANSI_RED='\033[31;1m'
|
||||
local ANSI_RESET='\033[0m'
|
||||
local result=0
|
||||
local count=1
|
||||
while (( count < 3 )); do
|
||||
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
|
||||
"$@"
|
||||
result=$?
|
||||
(( result == 0 )) && break
|
||||
count=$(($count + 1))
|
||||
count=$(( count + 1 ))
|
||||
sleep 1
|
||||
done
|
||||
|
||||
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
|
||||
|
||||
return $result
|
||||
@ -96,6 +96,8 @@ case $TESTENV in
|
||||
eslint)
|
||||
npm_install eslint
|
||||
;;
|
||||
shellcheck)
|
||||
;;
|
||||
*)
|
||||
pip_install pip
|
||||
pip_install -r misc/requirements/requirements-tox.txt
|
||||
|
@ -14,6 +14,16 @@ elif [[ $TESTENV == eslint ]]; then
|
||||
# travis env
|
||||
cd qutebrowser/javascript || exit 1
|
||||
eslint --color --report-unused-disable-directives .
|
||||
elif [[ $TESTENV == shellcheck ]]; then
|
||||
SCRIPTS=$( mktemp )
|
||||
find scripts/dev/ -name '*.sh' >"$SCRIPTS"
|
||||
find misc/userscripts/ -type f -exec grep -lE '[/ ][bd]ash$|[/ ]sh$|[/ ]ksh$' {} + >>"$SCRIPTS"
|
||||
mapfile -t scripts <"$SCRIPTS"
|
||||
rm -f "$SCRIPTS"
|
||||
docker run \
|
||||
-v "$PWD:/outside" \
|
||||
-w /outside \
|
||||
koalaman/shellcheck:latest "${scripts[@]}"
|
||||
else
|
||||
args=()
|
||||
[[ $TRAVIS_OS_NAME == osx ]] && args=('--qute-bdd-webengine' '--no-xvfb')
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# This script downloads the given release from GitHub so we can mirror it on
|
||||
# qutebrowser.org.
|
||||
@ -16,16 +17,16 @@ mkdir windows
|
||||
|
||||
base="https://github.com/qutebrowser/qutebrowser/releases/download/v$1"
|
||||
|
||||
wget "$base/qutebrowser-$1.tar.gz" || exit 1
|
||||
wget "$base/qutebrowser-$1.tar.gz.asc" || exit 1
|
||||
wget "$base/qutebrowser-$1.dmg" || exit 1
|
||||
wget "$base/qutebrowser_${1}-1_all.deb" || exit 1
|
||||
wget "$base/qutebrowser-$1.tar.gz"
|
||||
wget "$base/qutebrowser-$1.tar.gz.asc"
|
||||
wget "$base/qutebrowser-$1.dmg"
|
||||
wget "$base/qutebrowser_${1}-1_all.deb"
|
||||
|
||||
cd windows
|
||||
wget "$base/qutebrowser-${1}-amd64.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-win32.zip" || exit 1
|
||||
wget "$base/qutebrowser-${1}-amd64.msi"
|
||||
wget "$base/qutebrowser-${1}-win32.msi"
|
||||
wget "$base/qutebrowser-${1}-windows-standalone-amd64.zip"
|
||||
wget "$base/qutebrowser-${1}-windows-standalone-win32.zip"
|
||||
|
||||
dest="/srv/http/qutebrowser/releases/v$1"
|
||||
cd "$oldpwd"
|
||||
|
@ -1,14 +1,12 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ $PWD == */scripts ]]; then
|
||||
cd ..
|
||||
fi
|
||||
[[ $PWD == */scripts ]] && cd ..
|
||||
|
||||
echo > crash.log
|
||||
while :; do
|
||||
exit=0
|
||||
while (( $exit == 0)); do
|
||||
duration=$(($RANDOM%10000))
|
||||
while (( exit == 0 )); do
|
||||
duration=$(( RANDOM % 10000 ))
|
||||
python3 -m qutebrowser --debug ":later $duration quit" http://www.heise.de/
|
||||
exit=$?
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user