mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-03 04:20:01 +02:00
feat(gradle): Aliased to gradlew as well as gradle.
Added this change to the `README.md`. Also cleaned/reworded up the `README.md` a touch.
This commit is contained in:
parent
9e23925b85
commit
32b1498c1b
2 changed files with 17 additions and 8 deletions
|
|
@ -11,17 +11,25 @@ plugins=(... gradle)
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
This plugin creates a function called `gradle-or-gradlew`, which is aliased
|
This plugin creates a function called `gradle-or-gradlew`, which is aliased
|
||||||
to `gradle`, which is used to determine whether the current project directory
|
to `gradle` and `gradlew`. This function is is used to determine whether the
|
||||||
has a gradlew file. If `gradlew` is present it will be used, otherwise `gradle`
|
current project directory has a `gradlew` wrapper file. If this file is present
|
||||||
is used instead. Gradle tasks can be executed directly without regard for
|
it will be used, otherwise the `gradle` binary from the system environment is
|
||||||
whether it is `gradle` or `gradlew`. It also supports being called from
|
used instead. Gradle tasks can be executed directly without regard for whether
|
||||||
any directory inside the root project directory.
|
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:
|
Examples:
|
||||||
|
|
||||||
```zsh
|
```zsh
|
||||||
|
# Enter project directory
|
||||||
|
cd /my/gradle/project
|
||||||
|
# Will call `gradlew` if present or `gradle` if not
|
||||||
gradle test
|
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
|
## Completion
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ function gradle-or-gradlew() {
|
||||||
dir="${dir:h}"
|
dir="${dir:h}"
|
||||||
done
|
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
|
if [[ -f "$project_root/gradlew" ]]; then
|
||||||
echo "executing gradlew instead of gradle"
|
echo "executing local gradle wrapper instead of gradle"
|
||||||
"$project_root/gradlew" "$@"
|
"$project_root/gradlew" "$@"
|
||||||
else
|
else
|
||||||
command gradle "$@"
|
command gradle "$@"
|
||||||
|
|
@ -23,4 +23,5 @@ function gradle-or-gradlew() {
|
||||||
}
|
}
|
||||||
|
|
||||||
alias gradle=gradle-or-gradlew
|
alias gradle=gradle-or-gradlew
|
||||||
|
alias gradlew=gradle-or-gradlew
|
||||||
compdef _gradle gradle-or-gradlew
|
compdef _gradle gradle-or-gradlew
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue