]> arthur.barton.de Git - ax-zsh.git/commitdiff
std_functions: Add (very simple) "open" function
authorAlexander Barton <alex@barton.de>
Wed, 25 Aug 2021 14:05:17 +0000 (16:05 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 25 Aug 2021 14:05:17 +0000 (16:05 +0200)
Right now, this supports macOS (Darwin), Cygwin and Linux.

default_plugins/std_functions/std_functions.zshrc

index fd3378a29a2196e7f877c3040ca7398c631d42fe..6401e74fcee409a6132f8928dab9b6585f27add1 100644 (file)
@@ -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 "${@:$#}"
 }