6ace3cd18dd3cbc0e2631fa98051194b703fe4d7

Author
Paul Ossenbruggen <possen@quintescent.net>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

add xx command to Xcode plugin. Allows quick opening of files in Xcode. (#6812)

Diff

 1diff --git a/plugins/xcode/README.md b/plugins/xcode/README.md
 2index c12ce047fe51115b6ecda93c36883fb4539ff08b..37f882638f6d31430134c316746f135409ab28fa 100644
 3--- a/plugins/xcode/README.md
 4+++ b/plugins/xcode/README.md
 5@@ -19,7 +19,7 @@ plugins=(... xcode)
 6 | xcdd  | Purge all temporary build information    | rm -rf ~/Library/Developer/Xcode/DerivedData/* |
 7 | xcp   | Show currently selected Xcode directory  | xcode-select --print-path                      |
 8 | xcsel | Select different Xcode directory by path | sudo xcode-select --switch                     |
 9-
10+| xx    | Opens the files listed in Xcode          | open -a "Xcode.app"                            |
11 
12 
13 ## Functions
14@@ -29,6 +29,10 @@ plugins=(... xcode)
15 Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files.
16 Returns 1 if it didn't find any relevant files.
17 
18+###  `xx`
19+
20+Opens the files listed in Xcode, multiple files are opened in a multi-file browser.
21+
22 ###  `simulator`
23 
24 Opens the iOS Simulator from your command line, dependent on whichever is the active developer directory for Xcode. (That is, it respects the `xcsel` setting.)
25diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh
26index f711c39fb6237e8b950ecbb9ca433afc7e2ebf51..b46e05f2feca44ccb95276d8121a4b2ffe0c82db 100644
27--- a/plugins/xcode/xcode.plugin.zsh
28+++ b/plugins/xcode/xcode.plugin.zsh
29@@ -27,6 +27,17 @@ function xc {
30   fi
31 }
32 
33+# Opens a file or files in the Xcode IDE. Multiple files are opened in multi-file browser
34+# original author: @possen
35+function xx {
36+  if [[ $# == 0 ]]; then
37+    echo "Specify file(s) to open in xcode."
38+    return 1
39+  fi
40+  echo "${xcode_files}"
41+  open -a "Xcode.app" "$@"
42+}
43+
44 # "XCode-SELect by Version" - select Xcode by just version number
45 # Uses naming convention:
46 #  - different versions of Xcode are named Xcode-<version>.app or stored
47@@ -70,7 +81,7 @@ function xcselv {
48 
49 function _omz_xcode_print_xcselv_usage {
50   cat << EOF >&2
51-Usage: 
52+Usage:
53   xcselv <version>
54   xcselv [options]
55