From f0a0ba06c2ff3c3272173ee296fb561b5c7fc782 Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Mon, 2 Nov 2020 02:04:38 +0100 Subject: [PATCH] zsh:functions: Use portable syntax for functions Use a portable syntax for the function headers. Since I do not know where these functions could end in the future it makes it easier and more consistent to use the portable syntax. --- .config/zsh/plugins/functions.zsh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.config/zsh/plugins/functions.zsh b/.config/zsh/plugins/functions.zsh index f23e7c4..39f6a0e 100644 --- a/.config/zsh/plugins/functions.zsh +++ b/.config/zsh/plugins/functions.zsh @@ -2,7 +2,7 @@ ## Created: 2019-08-28 ## Compares two pdfs based on the result of pdftotext -function pdfdiff() { +pdfdiff() { if [[ $# -eq 2 && -r "$1" && -r "$2" ]]; then diff <(pdftotext "$1" -) <(pdftotext "$2" -) else @@ -12,7 +12,7 @@ function pdfdiff() { } ## Gets Passwd from bitwarden and copies it into the clipboard -function bwpwd() { +bwpwd() { if bw "get" "password" "$@" >/dev/null; then bw "get" "password" "$@" | tr -d '\n' | setclip else @@ -21,7 +21,7 @@ function bwpwd() { } ## creates directory and changes into it -function mkcd () { +mkcd () { # Create directory mkdir "$@" # shift arguments if mkdir options were used @@ -35,7 +35,7 @@ function mkcd () { } ## Encode and decode qr-codes -function qr() { +qr() { if [[ $# -eq 1 && -r "$1" ]]; then zbarimg "$1" else @@ -44,7 +44,7 @@ function qr() { } ## Edit config file -function conf() { +conf() { local CONF_EDITOR if [[ -n "$EDITOR" ]]; then CONF_EDITOR="$EDITOR" @@ -126,7 +126,7 @@ function conf() { } ## Change into config dir -function c() { +c() { CONF_DIR="$(_get_config_dir $*)" if [[ $? -eq 0 ]]; then cd "$CONF_DIR" @@ -136,7 +136,7 @@ function c() { fi } ## Get config directory -function _get_config_dir() { +_get_config_dir() { if [[ $# -gt 1 ]]; then printf "\033[1;31mPlease specify one config.\n\033[0m" >&2 return 1 @@ -153,7 +153,7 @@ function _get_config_dir() { } ## Function that resolves a command to the end -function resolve() { +resolve() { # TODO: comment!! # In script mode only the result and its arguments are printed # The result can then be used directly by other scripts without further @@ -246,7 +246,7 @@ function resolve() { } ## Grep a keyword at the beginning of a line (ignoring whitespace) in a man page -function mangrep() { +mangrep() { if [[ $# -lt 2 ]]; then printf "usage: mangrep []\n" >&2 printf "example: mangrep bash \"(declare|typeset)\"\n" >&2 @@ -294,7 +294,7 @@ crypt-umount() { } ## List items in trash if no argument is specified -function trash() { +trash() { if (( ! $# )); then command trash-list else @@ -303,7 +303,7 @@ function trash() { } ## Open nemo in current directory if no argument is specified -function nemo() { +nemo() { if (( ! $# )); then command nemo . else