mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-01 04:30:37 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
31e9ee262f
9 changed files with 1325 additions and 653 deletions
File diff suppressed because it is too large
Load diff
34
plugins/dotenv/README.md
Normal file
34
plugins/dotenv/README.md
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
# dotenv
|
||||||
|
|
||||||
|
Automatically load your project ENV variables from `.env` file when you `cd` into project root directory.
|
||||||
|
|
||||||
|
Storing configuration in the environment is one of the tenets of a [twelve-factor app](http://www.12factor.net). Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Just add the plugin to your `.zshrc`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
plugins=(git man dotenv)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Create `.env` file inside your project directory and put your local ENV variables there.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
```sh
|
||||||
|
export AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
|
||||||
|
export SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
|
||||||
|
export MONGO_URI=mongodb://127.0.0.1:27017
|
||||||
|
export PORT=3001
|
||||||
|
```
|
||||||
|
`export` is optional. This format works as well:
|
||||||
|
```sh
|
||||||
|
AWS_S3_TOKEN=d84a83539134f28f412c652b09f9f98eff96c9a
|
||||||
|
SECRET_KEY=7c6c72d959416d5aa368a409362ec6e2ac90d7f
|
||||||
|
MONGO_URI=mongodb://127.0.0.1:27017
|
||||||
|
PORT=3001
|
||||||
|
```
|
||||||
|
|
||||||
|
**It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it supposed to be local only.
|
||||||
10
plugins/dotenv/dotenv.plugin.zsh
Normal file
10
plugins/dotenv/dotenv.plugin.zsh
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
source_env() {
|
||||||
|
if [[ -f .env ]]; then
|
||||||
|
source .env
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook chpwd source_env
|
||||||
|
|
@ -43,6 +43,7 @@ alias g='git'
|
||||||
alias ga='git add'
|
alias ga='git add'
|
||||||
alias gaa='git add --all'
|
alias gaa='git add --all'
|
||||||
alias gapa='git add --patch'
|
alias gapa='git add --patch'
|
||||||
|
alias gau='git add --update'
|
||||||
|
|
||||||
alias gb='git branch'
|
alias gb='git branch'
|
||||||
alias gba='git branch -a'
|
alias gba='git branch -a'
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ _gradle_does_task_list_need_generating () {
|
||||||
}
|
}
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# Parse the tasks from `gradle(w) tasks --all` into .gradletasknamecache
|
# Parse the tasks from `gradle(w) tasks --all` and return them to the calling function.
|
||||||
# All lines in the output from gradle(w) that are between /^-+$/ and /^\s*$/
|
# All lines in the output from gradle(w) that are between /^-+$/ and /^\s*$/
|
||||||
# are considered to be tasks. If and when gradle adds support for listing tasks
|
# are considered to be tasks. If and when gradle adds support for listing tasks
|
||||||
# for programmatic parsing, this method can be deprecated.
|
# for programmatic parsing, this method can be deprecated.
|
||||||
|
|
@ -76,7 +76,7 @@ _gradle_parse_tasks () {
|
||||||
task_name_buffer=""
|
task_name_buffer=""
|
||||||
elif [[ $line =~ ^\s*$ ]]; then
|
elif [[ $line =~ ^\s*$ ]]; then
|
||||||
if [[ "$lines_might_be_tasks" = true ]]; then
|
if [[ "$lines_might_be_tasks" = true ]]; then
|
||||||
# If a newline is found, send the buffer to .gradletasknamecache
|
# If a newline is found, echo the buffer to the calling function
|
||||||
while read -r task; do
|
while read -r task; do
|
||||||
echo $task | awk '/[a-zA-Z0-9:-]+/ {print $1}'
|
echo $task | awk '/[a-zA-Z0-9:-]+/ {print $1}'
|
||||||
done <<< "$task_name_buffer"
|
done <<< "$task_name_buffer"
|
||||||
|
|
@ -90,6 +90,25 @@ _gradle_parse_tasks () {
|
||||||
done <<< "$1"
|
done <<< "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
##############
|
||||||
|
# Gradle tasks from subprojects are allowed to be executed without specifying
|
||||||
|
# the subproject; that task will then be called on all subprojects.
|
||||||
|
# gradle(w) tasks --all only lists tasks per subproject, but when autocompleting
|
||||||
|
# we often want to be able to run a specific task on all subprojects, e.g.
|
||||||
|
# "gradle clean".
|
||||||
|
# This function uses the list of tasks from "gradle tasks --all", and for each
|
||||||
|
# line grabs everything after the last ":" and combines that output with the original
|
||||||
|
# output. The combined list is returned as the result of this function.
|
||||||
|
##############
|
||||||
|
_gradle_parse_and_extract_tasks () {
|
||||||
|
# All tasks
|
||||||
|
tasks=$(_gradle_parse_tasks "$1")
|
||||||
|
# Task name without sub project(s) prefix
|
||||||
|
simple_tasks=$(echo $tasks | awk 'BEGIN { FS = ":" } { print $NF }')
|
||||||
|
echo "$tasks\n$simple_tasks"
|
||||||
|
}
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Discover the gradle tasks by running "gradle tasks --all"
|
# Discover the gradle tasks by running "gradle tasks --all"
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
@ -97,7 +116,7 @@ _gradle_tasks () {
|
||||||
if [[ -f build.gradle ]]; then
|
if [[ -f build.gradle ]]; then
|
||||||
_gradle_arguments
|
_gradle_arguments
|
||||||
if _gradle_does_task_list_need_generating; then
|
if _gradle_does_task_list_need_generating; then
|
||||||
_gradle_parse_tasks "$(gradle tasks --all)" > .gradletasknamecache
|
_gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache
|
||||||
fi
|
fi
|
||||||
compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache)
|
compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache)
|
||||||
fi
|
fi
|
||||||
|
|
@ -107,7 +126,7 @@ _gradlew_tasks () {
|
||||||
if [[ -f build.gradle ]]; then
|
if [[ -f build.gradle ]]; then
|
||||||
_gradle_arguments
|
_gradle_arguments
|
||||||
if _gradle_does_task_list_need_generating; then
|
if _gradle_does_task_list_need_generating; then
|
||||||
_gradle_parse_tasks "$(./gradlew tasks --all)" > .gradletasknamecache
|
_gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache
|
||||||
fi
|
fi
|
||||||
compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache)
|
compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache)
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,10 @@ _1st_arguments=(
|
||||||
"domains\:add":"add a custom domain to an app"
|
"domains\:add":"add a custom domain to an app"
|
||||||
"domains\:remove":"remove a custom domain from an app"
|
"domains\:remove":"remove a custom domain from an app"
|
||||||
"domains\:clear":"remove all custom domains from an app"
|
"domains\:clear":"remove all custom domains from an app"
|
||||||
|
"features":"list available app features"
|
||||||
|
"features\:disable":"disables a feature"
|
||||||
|
"features\:enable":"enables an feature"
|
||||||
|
"features\:info":"displays additional information about feature"
|
||||||
"help":"list available commands or display help for a specific command"
|
"help":"list available commands or display help for a specific command"
|
||||||
"keys":"display keys for the current user"
|
"keys":"display keys for the current user"
|
||||||
"keys\:add":"add a key for the current user"
|
"keys\:add":"add a key for the current user"
|
||||||
|
|
@ -144,5 +148,4 @@ _arguments \
|
||||||
'(--app)--app[the app name]' \
|
'(--app)--app[the app name]' \
|
||||||
'(--remote)--remote[the remote name]' \
|
'(--remote)--remote[the remote name]' \
|
||||||
'(--help)--help[help about the current command]' \
|
'(--help)--help[help about the current command]' \
|
||||||
&& return 0
|
&& return 0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,9 @@ case $state in
|
||||||
(test)
|
(test)
|
||||||
_files
|
_files
|
||||||
;;
|
;;
|
||||||
|
(run)
|
||||||
|
_files
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,26 @@
|
||||||
# React Native
|
# React Native plugin
|
||||||
|
|
||||||
**Maintainer:** [BilalBudhani](https://github.com/BilalBudhani)
|
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.
|
||||||
|
|
||||||
### List of Aliases
|
To enable, add `react-native` to your `plugins` array in your zshrc file:
|
||||||
|
|
||||||
Alias | React Native command
|
```zsh
|
||||||
------|---------------------
|
plugins=(... react-native)
|
||||||
**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"*
|
|
||||||
|
|
||||||
|
## 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"` |
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
|
alias rn='react-native'
|
||||||
|
alias rns='react-native start'
|
||||||
|
alias rnlink='react-native link'
|
||||||
|
|
||||||
alias rnand='react-native run-android'
|
alias rnand='react-native run-android'
|
||||||
|
alias rnios='react-native run-ios'
|
||||||
alias rnios4s='react-native run-ios --simulator "iPhone 4s"'
|
alias rnios4s='react-native run-ios --simulator "iPhone 4s"'
|
||||||
alias rnios5='react-native run-ios --simulator "iPhone 5"'
|
alias rnios5='react-native run-ios --simulator "iPhone 5"'
|
||||||
alias rnios5s='react-native run-ios --simulator "iPhone 5s"'
|
alias rnios5s='react-native run-ios --simulator "iPhone 5s"'
|
||||||
alias rnios6='react-native run-ios --simulator "iPhone 6"'
|
alias rnios6='react-native run-ios --simulator "iPhone 6"'
|
||||||
alias rnios6s='react-native run-ios --simulator "iPhone 6s"'
|
alias rnios6s='react-native run-ios --simulator "iPhone 6s"'
|
||||||
alias rnios='react-native run-ios'
|
|
||||||
alias rnlink='react-native link'
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue