commit be312d0dd77b894cef40277af18f1fd0ba368122
parent 7234ceb2493a175eca7a93f453126f02efd06fa4
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Tue, 27 Oct 2020 11:30:57 +0100
open: add -a flag
Former-commit-id: 7e2a8f0e7ee4dc1697939ec6405754cdccaceab8
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/scripts/open b/scripts/open
@@ -6,6 +6,10 @@ while [ $(($#)) -ne 0 ]; do
       background=1
       shift
       ;;
+    -a)
+      app="$2"
+      shift 2
+      ;;
     -h|--help)
       echo "Usage:"
       echo "open [-g] file"
@@ -29,13 +33,15 @@ eval set -- "$PARAMS"
 
 background=${background:-0}
 os=$(uname -s | tr '[:upper:]' '[:lower:]')
-case $os in
+
+case "$os" in
   linux*)
     # not sure how backgrounding is handled with xdg-open
     command xdg-open "$@"
     ;;
   darwin*)
     if [ $background -eq 1 ]; then /usr/bin/open -gj "$@"
+    elif [ -n "$app" ]; then /usr/bin/open -a "$app" "$@"
     else /usr/bin/open "$@"
     fi
     ;;