mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-29 19:14:05 +08:00
Merge 32b1498c1b into df64afb062
This commit is contained in:
commit
b7ae3fbbbc
@ -11,17 +11,25 @@ plugins=(... gradle)
|
||||
## Usage
|
||||
|
||||
This plugin creates a function called `gradle-or-gradlew`, which is aliased
|
||||
to `gradle`, which is used to determine whether the current project directory
|
||||
has a gradlew file. If `gradlew` is present it will be used, otherwise `gradle`
|
||||
is used instead. Gradle tasks can be executed directly without regard for
|
||||
whether it is `gradle` or `gradlew`. It also supports being called from
|
||||
any directory inside the root project directory.
|
||||
to `gradle` and `gradlew`. This function is is used to determine whether the
|
||||
current project directory has a `gradlew` wrapper file. If this file is present
|
||||
it will be used, otherwise the `gradle` binary from the system environment is
|
||||
used instead. Gradle tasks can be executed directly without regard for whether
|
||||
it is the environment `gradle` or the `gradlew` wrapper being invoked. It also
|
||||
supports being called from any directory inside the root directory of a Gradle
|
||||
project.
|
||||
|
||||
Examples:
|
||||
|
||||
```zsh
|
||||
# Enter project directory
|
||||
cd /my/gradle/project
|
||||
# Will call `gradlew` if present or `gradle` if not
|
||||
gradle test
|
||||
gradle build
|
||||
# Enter a sub-directory of the project directory
|
||||
cd my/sub/directory
|
||||
# Will call `gradlew` from `/my/gradle/project` if present or `gradle` if not
|
||||
gradlew build
|
||||
```
|
||||
|
||||
## Completion
|
||||
|
||||
@ -13,9 +13,9 @@ function gradle-or-gradlew() {
|
||||
dir="${dir:h}"
|
||||
done
|
||||
|
||||
# if gradlew found, run it instead of gradle
|
||||
# if local gradle wrapper found, run it instead of gradle
|
||||
if [[ -f "$project_root/gradlew" ]]; then
|
||||
echo "executing gradlew instead of gradle"
|
||||
echo "executing local gradle wrapper instead of gradle"
|
||||
"$project_root/gradlew" "$@"
|
||||
else
|
||||
command gradle "$@"
|
||||
@ -23,4 +23,5 @@ function gradle-or-gradlew() {
|
||||
}
|
||||
|
||||
alias gradle=gradle-or-gradlew
|
||||
alias gradlew=gradle-or-gradlew
|
||||
compdef _gradle gradle-or-gradlew
|
||||
|
||||
Loading…
Reference in New Issue
Block a user