From: Alexander Barton Date: Wed, 25 Aug 2021 14:05:17 +0000 (+0200) Subject: std_functions: Add (very simple) "open" function X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1702b785a006049187ca2e9dfb1ec0e310574d2f;p=ax-zsh.git std_functions: Add (very simple) "open" function Right now, this supports macOS (Darwin), Cygwin and Linux. --- diff --git a/default_plugins/std_functions/std_functions.zshrc b/default_plugins/std_functions/std_functions.zshrc index fd3378a..6401e74 100644 --- a/default_plugins/std_functions/std_functions.zshrc +++ b/default_plugins/std_functions/std_functions.zshrc @@ -1,6 +1,21 @@ # AX-ZSH: Alex' Modular ZSH Configuration # std_functions: Setup standard ("common") functions +function open_command() { + case $OSTYPE in + darwin*) + open "$@" || return 1 + ;; + cygwin*) + cygstart "$@" || return 1 + ;; + linux*) + nohup xdg-open "$@" &>/dev/null || return 1 + ;; + esac + return 1 +} + function take() { mkdir -p "$@" && cd "${@:$#}" }