summaryrefslogtreecommitdiff
path: root/plugins/react-native
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/react-native')
-rw-r--r--plugins/react-native/README.md29
-rw-r--r--plugins/react-native/_react-native32
-rw-r--r--plugins/react-native/react-native.plugin.zsh14
3 files changed, 75 insertions, 0 deletions
diff --git a/plugins/react-native/README.md b/plugins/react-native/README.md
new file mode 100644
index 000000000..980246cf1
--- /dev/null
+++ b/plugins/react-native/README.md
@@ -0,0 +1,29 @@
+# React Native plugin
+
+This plugin adds completion for [`react-native`](https://facebook.github.io/react-native/).
+It also defines a few [aliases](#aliases) for the commands more frequently used.
+
+To enable, add `react-native` to your `plugins` array in your zshrc file:
+
+```zsh
+plugins=(... react-native)
+```
+
+## Aliases
+
+| Alias | React Native command |
+|:------------|:-----------------------------------------------|
+| **rn** | `react-native` |
+| **rns** | `react-native start` |
+| **rnlink** | `react-native link` |
+| _App testing_ |
+| **rnand** | `react-native run-android` |
+| **rnios** | `react-native run-ios` |
+| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` |
+| **rnios5** | `react-native run-ios --simulator "iPhone 5"` |
+| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` |
+| **rnios6** | `react-native run-ios --simulator "iPhone 6"` |
+| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` |
+| _Logging_ |
+| **rnland** | `react-native log-android` |
+| **rnlios** | `react-native log-ios` |
diff --git a/plugins/react-native/_react-native b/plugins/react-native/_react-native
new file mode 100644
index 000000000..893ac040a
--- /dev/null
+++ b/plugins/react-native/_react-native
@@ -0,0 +1,32 @@
+#compdef react-native
+#autoload
+
+local -a _1st_arguments
+_1st_arguments=(
+ 'init:<ProjectName> generates a new project and installs its dependencies'
+ 'android:creates an empty android project'
+ 'start:starts the webserver'
+ 'run-ios:builds your app and starts it on iOS simulator'
+ 'run-android:builds your app and starts it on a connected Android emulator or device'
+ 'new-library:generates a native library bridge'
+ 'bundle:builds the javascript bundle for offline use'
+ 'unbundle:builds javascript as "unbundle" for offline use'
+ 'link:[options] <packageName> links all native dependencies'
+ 'unlink:[options] <packageName> unlink native dependency'
+ 'install:[options] <packageName> install and link native dependencies'
+ 'uninstall:[options] <packageName> uninstall and unlink native dependencies'
+ "upgrade:upgrade your app's template files to the latest version; run this after updating the react-native version in your package.json and running npm install"
+ 'log-android:starts adb logcat'
+ 'log-ios:starts iOS device syslog tail'
+)
+
+
+_arguments \
+ '(--version)--version[show version]' \
+ '(--help)--help[show help]' \
+ '*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "react-native subcommand" _1st_arguments
+ return
+fi
diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh
new file mode 100644
index 000000000..0566941a1
--- /dev/null
+++ b/plugins/react-native/react-native.plugin.zsh
@@ -0,0 +1,14 @@
+alias rn='react-native'
+alias rns='react-native start'
+alias rnlink='react-native link'
+
+alias rnand='react-native run-android'
+alias rnios='react-native run-ios'
+alias rnios4s='react-native run-ios --simulator "iPhone 4s"'
+alias rnios5='react-native run-ios --simulator "iPhone 5"'
+alias rnios5s='react-native run-ios --simulator "iPhone 5s"'
+alias rnios6='react-native run-ios --simulator "iPhone 6"'
+alias rnios6s='react-native run-ios --simulator "iPhone 6s"'
+
+alias rnland='react-native log-android'
+alias rnlios='react-native log-ios'