From 905b43b5d4bcf1b0038ef747822ee27da7374310 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 18 Sep 2023 17:41:53 +0200 Subject: [PATCH] bin: dash resistance --- .config/git/config | 2 ++ .config/shell/browse | 2 +- .config/zsh/.zshrc | 1 + .local/bin/scripts/boost | 7 +++++++ .local/bin/scripts/help | 7 +++---- .local/bin/scripts/synctray | 7 ------- .local/bin/scripts/xo | 2 +- 7 files changed, 15 insertions(+), 13 deletions(-) create mode 100755 .local/bin/scripts/boost delete mode 100755 .local/bin/scripts/synctray diff --git a/.config/git/config b/.config/git/config index 1f872ab..10bd4a8 100644 --- a/.config/git/config +++ b/.config/git/config @@ -193,3 +193,5 @@ path = "~/.config/yadm/gitconfig" [safe] directory = /opt/flutter +[credential] + helper = cache --timeout 1000 diff --git a/.config/shell/browse b/.config/shell/browse index c8d9ba9..eeac2e5 100644 --- a/.config/shell/browse +++ b/.config/shell/browse @@ -49,7 +49,7 @@ cd() { # TODO test whether still needed with exa command ls --sort=none --quote-name | head -12 | - COLUMNS=$(tput cols) xargs $(which exa >/dev/null 2>&1 && echo "exa --list-dirs --icons --reverse" || echo 'ls --format=vertical --literal --classify --directory') --sort=time --color=always | + COLUMNS=$(tput cols) xargs $(which exa >/dev/null 2>&1 && echo "exa --list-dirs --icons --reverse" || echo 'ls --format=vertical --literal --classify --directory') --sort=time --color=always -- | head -3 code=$? && test $code -eq 141 || return $code fi diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 0fe7078..8cd1d42 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -190,6 +190,7 @@ source_existing() { } source_existing $CONFIG_ZSH/.p10k.zsh # To customize prompt, run `p10k configure` or edit .p10k.zsh. +source_existing $CONFIG_ZSH/sgpt.zsh source_existing /usr/share/fzf/key-bindings.zsh /usr/share/fzf/completion.zsh source_existing "$NVM_DIR/nvm.sh" diff --git a/.local/bin/scripts/boost b/.local/bin/scripts/boost new file mode 100755 index 0000000..9b1279d --- /dev/null +++ b/.local/bin/scripts/boost @@ -0,0 +1,7 @@ +#!/bin/sh -e +# Install syncthingtray and other things using boost, preventing conflicts +# Pass -git as argument to install the git version with dependencies +pacman -Qq | grep -E '^(syncthingtray)' | xargs --no-run-if-empty yay -R --noconfirm +suffix=$1 +yay --noconfirm -Syy --nobatchinstall --answerdiff none boost c++utilities$suffix qtforkawesome$suffix qtutilities$suffix +yay --noconfirm -S syncthingtray$suffix guitarix diff --git a/.local/bin/scripts/help b/.local/bin/scripts/help index 3083973..a326e70 100755 --- a/.local/bin/scripts/help +++ b/.local/bin/scripts/help @@ -1,8 +1,9 @@ #!/bin/sh -e -# open info-page, man-page or command help +# open info-page, man-page or command with help flag # depends: unbuffer # optdepends: highlight(dotfiles) # TODO show tldr page +# TODO extract help in standard format from scripts paginate="${PAGER:-less} +Gg" case "$1" in (-d) browse=1; shift;; @@ -25,13 +26,11 @@ showinfo() { cmd="$1" case "$cmd" in - # TODO extract help in standard format from scripts (fwupdmgr|hunt|rdoc|gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr|docker|jrnl|difft|wiked-diff|qpdf|ninja) unbuffer "$@" --help | sed 's|^[^ ].*:|\0|' | $paginate;; (caddy|stretchly|go|flutter) shift "$cmd" help "$@" | $paginate;; - # Non-standard help flags - (doom) "$@" --help;; # Doom paginates itself + (doom|sgpt) "$@" --help;; # Paginates itself (mpw) "$@" -h 2>&1 | $paginate;; (spectre|plantuml|java) unbuffer "$@" -help | $paginate;; (rails) { "$@" -H && "$@" --help; } | $paginate;; diff --git a/.local/bin/scripts/synctray b/.local/bin/scripts/synctray deleted file mode 100755 index 551ceb2..0000000 --- a/.local/bin/scripts/synctray +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -e -# Install syncthingtray, preventing conflicts -# Pass -git as argument to install the git version with dependencies -pacman -Qq | grep '^syncthingtray' | xargs -r yay --noconfirm -R -suffix=$1 -yay --noconfirm -Syy --nobatchinstall boost c++utilities$suffix qtforkawesome$suffix qtutilities$suffix -yay --noconfirm -S syncthingtray$suffix diff --git a/.local/bin/scripts/xo b/.local/bin/scripts/xo index 08ecab4..9de9175 100755 --- a/.local/bin/scripts/xo +++ b/.local/bin/scripts/xo @@ -2,6 +2,6 @@ # xdg-open all given files # TODO handle .desktop-files with gtk-launch/dex/kioclient exec, add selector from xdg-mime-file while test $# -gt 0; do - xdg-open "$1" + xdg-open "$(case "$1" in (-*) echo './';; esac)$1" shift done