use sd for managin scripts

This commit is contained in:
Al-Hassan Abdel-Raouf 2022-12-31 23:33:21 +02:00
parent fcda7ed476
commit df5c4def7e
8 changed files with 50 additions and 18 deletions

View File

@ -33,3 +33,6 @@ zsh-users/zsh-autosuggestions
zsh-users/zsh-completions
zdharma-continuum/fast-syntax-highlighting kind:defer
zsh-users/zsh-history-substring-search
# Managing Personal Scripts
ianthehenry/sd

View File

@ -42,3 +42,5 @@ fpath+=( /home/alhassan/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLA
zsh-defer source /home/alhassan/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
fpath+=( /home/alhassan/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search )
source /home/alhassan/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search/zsh-history-substring-search.plugin.zsh
fpath+=( /home/alhassan/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ianthehenry-SLASH-sd )
source /home/alhassan/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-ianthehenry-SLASH-sd/sd.plugin.zsh

View File

@ -1,9 +0,0 @@
value=$(<./adblock-list)
echo $value
for entry in $value
do
./adblock-update.sh $entry
done

View File

@ -0,0 +1,15 @@
#!/bin/bash
parent_path=$(
cd "$(dirname "${BASH_SOURCE[0]}")"
pwd -P
)
cd "$parent_path"
value=$(<./adblock-list)
echo $value
for entry in $value; do
./adblock-update.sh $entry
done

View File

@ -7,9 +7,15 @@
# URL URL of the filterlist to download
# -h, --help Display this help-message and exit
parent_path=$(
cd "$(dirname "${BASH_SOURCE[0]}")"
pwd -P
)
cd "$parent_path"
# help message
function usage ()
{
function usage() {
cat <<EOF
Usage: $0 [-h] [URL]
This script can be used to download/update filterlists for the luakit adblock-module.
@ -21,8 +27,7 @@ EOF
}
# check for $XDG_DATA_HOME or fallback
[[ -z "$XDG_DATA_HOME" ]] && DATADIR="$HOME/.local/share" || DATADIR="$XDG_DATA_HOME"
[[ -z $XDG_DATA_HOME ]] && DATADIR="$HOME/.local/share" || DATADIR="$XDG_DATA_HOME"
# use URL if given
if (($# == 1)) || (($# == 0)); then

16
sd/usephp Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
[ "$#" -lt "1" ] && {
echo "Configure current shell to use a specific major PHP version.
Usage: usephp 7"
exit 0
}
binary="php${1}"
wanted="/usr/bin/${binary}"
[ ! -f "${wanted}" ] && {
echo "'${binary}' not found. Using 'php'."
wanted="/usr/bin/php"
}
ln -sf "${wanted}" "${HOME}/bin/php"
inUse=$(php -nr "echo phpversion();")
echo "Shell configured to use PHP ${inUse}."