Skip to content

Commit 16003d0

Browse files
committed
fix bash completion
1 parent 05a6ba9 commit 16003d0

File tree

3 files changed

+82
-90
lines changed

3 files changed

+82
-90
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,15 +361,15 @@ tasks.register("generateCompletionScripts") {
361361

362362
fun generateBashLongOpts(options: List<CliOption>): String = options.filter { it.twoDashOption != null }
363363
.sortedBy { it.twoDashOption }
364-
.joinToString("\n ") {
364+
.joinToString("\n") {
365365
val incubatingText = if (it.incubating) " [incubating]" else ""
366366
val paddedOption = "--${it.twoDashOption}".padEnd(30)
367367
"$paddedOption - ${it.description?.lineSequence()?.first()} $incubatingText"
368368
}
369369

370370
fun getBashShortOpts(options: List<CliOption>): String = options.filter { it.oneDashOption != null }
371371
.sortedBy { it.oneDashOption?.lowercase(Locale.getDefault()) }
372-
.joinToString("\n ") {
372+
.joinToString("\n") {
373373
val incubatingText = if (it.incubating) " [incubating]" else ""
374374
val paddedOption = "-${it.oneDashOption}".padEnd(30)
375375
"$paddedOption - ${it.description?.lineSequence()?.first()} $incubatingText"

gradle-completion.bash

Lines changed: 76 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -79,63 +79,61 @@ __gradle-long-options() {
7979
local cur
8080
_get_comp_words_by_ref -n : cur
8181

82-
local args="\
83-
--build-cache - Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds.
84-
--configuration-cache - Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.
85-
--configuration-cache-problems - Configures how the configuration cache handles problems (fail or warn). Defaults to fail.
86-
--configure-on-demand - Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds. [incubating]
87-
--console - Specifies which type of console output to generate. Values are 'plain', 'colored', 'auto' (default), 'rich' or 'verbose'.
88-
--continue - Continue task execution after a task failure.
89-
--continuous - Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.
90-
--daemon - Uses the Gradle daemon to run the build. Starts the daemon if not running.
91-
--debug - Log in debug mode (includes normal stacktrace).
92-
--dependency-verification - Configures the dependency verification mode. Values are 'strict', 'lenient' or 'off'.
93-
--dry-run - Run the builds with all task actions disabled.
94-
--exclude-task - Specify a task to be excluded from execution.
95-
--export-keys - Exports the public keys used for dependency verification.
96-
--foreground - Starts the Gradle daemon in the foreground.
97-
--full-stacktrace - Print out the full (very verbose) stacktrace for all exceptions.
98-
--gradle-user-home - Specifies the Gradle user home directory. Defaults to ~/.gradle
99-
--help - Shows a help message.
100-
--include-build - Include the specified build in the composite.
101-
--info - Set log level to info.
102-
--init-script - Specify an initialization script.
103-
--max-workers - Configure the number of concurrent workers Gradle is allowed to use.
104-
--no-build-cache - Disables the Gradle build cache.
105-
--no-configuration-cache - Disables the configuration cache.
106-
--no-configure-on-demand - Disables the use of configuration on demand. [incubating]
107-
--no-continue - Stop task execution after a task failure.
108-
--no-daemon - Do not use the Gradle daemon to run the build. Useful occasionally if you have configured Gradle to always run with the daemon by default.
109-
--no-parallel - Disables parallel execution to build projects.
110-
--no-problems-report - (Experimental) disables HTML problems report
111-
--no-rebuild - Do not rebuild project dependencies.
112-
--no-scan - Disables the creation of a Build Scan.
113-
--no-watch-fs - Disables watching the file system.
114-
--offline - Execute the build without accessing network resources.
115-
--parallel - Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.
116-
--priority - Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Values are 'normal' (default) or 'low'
117-
--problems-report - (Experimental) enables HTML problems report
118-
--profile - Profile build execution time and generates a report in the <build_dir>/reports/profile directory.
119-
--project-cache-dir - Specify the project-specific cache directory. Defaults to .gradle in the root project directory.
120-
--project-dir - Specifies the start directory for Gradle. Defaults to current directory.
121-
--property-upgrade-report - (Experimental) Runs build with experimental property upgrade report.
122-
--quiet - Log errors only.
123-
--refresh-dependencies - Refresh the state of dependencies.
124-
--refresh-keys - Refresh the public keys used for dependency verification.
125-
--rerun-tasks - Ignore previously cached task results.
126-
--scan - Generate a Build Scan (powered by Develocity).
127-
--stacktrace - Print out the stacktrace for all exceptions.
128-
--status - Shows status of running and recently stopped Gradle daemon(s).
129-
--stop - Stops the Gradle daemon if it is running.
130-
--task-graph - (Experimental) Print task graph instead of executing tasks.
131-
--update-locks - Perform a partial update of the dependency lock, letting passed in module notations change version. [incubating]
132-
--version - Shows the version info.
133-
--warn - Set log level to warn.
134-
--warning-mode - Specifies which mode of warnings to generate. Values are 'all', 'fail', 'summary'(default) or 'none'
135-
--watch-fs - Enables watching the file system for changes, allowing data about the file system to be re-used for the next build.
136-
--write-locks - Persists dependency resolution for locked configurations, ignoring existing locking information if it exists
137-
--write-verification-metadata - Generates checksums for dependencies used in the project (comma-separated list)\
138-
"
82+
local args="--build-cache - Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds.
83+
--configuration-cache - Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.
84+
--configuration-cache-problems - Configures how the configuration cache handles problems (fail or warn). Defaults to fail.
85+
--configure-on-demand - Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds. [incubating]
86+
--console - Specifies which type of console output to generate. Values are 'plain', 'colored', 'auto' (default), 'rich' or 'verbose'.
87+
--continue - Continue task execution after a task failure.
88+
--continuous - Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.
89+
--daemon - Uses the Gradle daemon to run the build. Starts the daemon if not running.
90+
--debug - Log in debug mode (includes normal stacktrace).
91+
--dependency-verification - Configures the dependency verification mode. Values are 'strict', 'lenient' or 'off'.
92+
--dry-run - Run the builds with all task actions disabled.
93+
--exclude-task - Specify a task to be excluded from execution.
94+
--export-keys - Exports the public keys used for dependency verification.
95+
--foreground - Starts the Gradle daemon in the foreground.
96+
--full-stacktrace - Print out the full (very verbose) stacktrace for all exceptions.
97+
--gradle-user-home - Specifies the Gradle user home directory. Defaults to ~/.gradle
98+
--help - Shows a help message.
99+
--include-build - Include the specified build in the composite.
100+
--info - Set log level to info.
101+
--init-script - Specify an initialization script.
102+
--max-workers - Configure the number of concurrent workers Gradle is allowed to use.
103+
--no-build-cache - Disables the Gradle build cache.
104+
--no-configuration-cache - Disables the configuration cache.
105+
--no-configure-on-demand - Disables the use of configuration on demand. [incubating]
106+
--no-continue - Stop task execution after a task failure.
107+
--no-daemon - Do not use the Gradle daemon to run the build. Useful occasionally if you have configured Gradle to always run with the daemon by default.
108+
--no-parallel - Disables parallel execution to build projects.
109+
--no-problems-report - (Experimental) disables HTML problems report
110+
--no-rebuild - Do not rebuild project dependencies.
111+
--no-scan - Disables the creation of a Build Scan.
112+
--no-watch-fs - Disables watching the file system.
113+
--offline - Execute the build without accessing network resources.
114+
--parallel - Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.
115+
--priority - Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Values are 'normal' (default) or 'low'
116+
--problems-report - (Experimental) enables HTML problems report
117+
--profile - Profile build execution time and generates a report in the <build_dir>/reports/profile directory.
118+
--project-cache-dir - Specify the project-specific cache directory. Defaults to .gradle in the root project directory.
119+
--project-dir - Specifies the start directory for Gradle. Defaults to current directory.
120+
--property-upgrade-report - (Experimental) Runs build with experimental property upgrade report.
121+
--quiet - Log errors only.
122+
--refresh-dependencies - Refresh the state of dependencies.
123+
--refresh-keys - Refresh the public keys used for dependency verification.
124+
--rerun-tasks - Ignore previously cached task results.
125+
--scan - Generate a Build Scan (powered by Develocity).
126+
--stacktrace - Print out the stacktrace for all exceptions.
127+
--status - Shows status of running and recently stopped Gradle daemon(s).
128+
--stop - Stops the Gradle daemon if it is running.
129+
--task-graph - (Experimental) Print task graph instead of executing tasks.
130+
--update-locks - Perform a partial update of the dependency lock, letting passed in module notations change version. [incubating]
131+
--version - Shows the version info.
132+
--warn - Set log level to warn.
133+
--warning-mode - Specifies which mode of warnings to generate. Values are 'all', 'fail', 'summary'(default) or 'none'
134+
--watch-fs - Enables watching the file system for changes, allowing data about the file system to be re-used for the next build.
135+
--write-locks - Persists dependency resolution for locked configurations, ignoring existing locking information if it exists
136+
--write-verification-metadata - Generates checksums for dependencies used in the project (comma-separated list)"
139137

140138
COMPREPLY=( $(compgen -W "$args" -- "$cur") )
141139
}
@@ -144,8 +142,7 @@ __gradle-properties() {
144142
local cur
145143
_get_comp_words_by_ref -n : cur
146144

147-
local args="\
148-
-Dgradle.user.home= - Specifies the Gradle user home directory. Defaults to ~/.gradle
145+
local args="-Dgradle.user.home= - Specifies the Gradle user home directory. Defaults to ~/.gradle
149146
-Dorg.gradle.projectcachedir= - Specify the project-specific cache directory. Defaults to .gradle in the root project directory.
150147
-Dorg.gradle.continue= - Continue task execution after a task failure.
151148
-Dorg.gradle.continuous.quietperiod= -
@@ -193,8 +190,7 @@ __gradle-properties() {
193190
-Dorg.gradle.java.installations.fromEnv= -
194191
-Dorg.gradle.java.installations.auto-detect= -
195192
-Dorg.gradle.java.installations.auto-download= -
196-
-Dorg.gradle.java.installations.idea-jdks-directory= -\
197-
"
193+
-Dorg.gradle.java.installations.idea-jdks-directory= -"
198194
COMPREPLY=( $(compgen -W "$args" -- "$cur") )
199195
return 0
200196
}
@@ -204,24 +200,24 @@ __gradle-short-options() {
204200
_get_comp_words_by_ref -n : cur
205201

206202
local args="\
207-
-a - Do not rebuild project dependencies.
208-
-d - Log in debug mode (includes normal stacktrace).
209-
-F - Configures the dependency verification mode. Values are 'strict', 'lenient' or 'off'.
210-
-g - Specifies the Gradle user home directory. Defaults to ~/.gradle
211-
-h - Shows a help message.
212-
-I - Specify an initialization script.
213-
-i - Set log level to info.
214-
-m - Run the builds with all task actions disabled.
215-
-M - Generates checksums for dependencies used in the project (comma-separated list)
216-
-p - Specifies the start directory for Gradle. Defaults to current directory.
217-
-q - Log errors only.
218-
-s - Print out the stacktrace for all exceptions.
219-
-S - Print out the full (very verbose) stacktrace for all exceptions.
220-
-t - Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.
221-
-U - Refresh the state of dependencies.
222-
-v - Shows the version info.
223-
-w - Set log level to warn.
224-
-x - Specify a task to be excluded from execution.\
203+
-a - Do not rebuild project dependencies.
204+
-d - Log in debug mode (includes normal stacktrace).
205+
-F - Configures the dependency verification mode. Values are 'strict', 'lenient' or 'off'.
206+
-g - Specifies the Gradle user home directory. Defaults to ~/.gradle
207+
-h - Shows a help message.
208+
-I - Specify an initialization script.
209+
-i - Set log level to info.
210+
-m - Run the builds with all task actions disabled.
211+
-M - Generates checksums for dependencies used in the project (comma-separated list)
212+
-p - Specifies the start directory for Gradle. Defaults to current directory.
213+
-q - Log errors only.
214+
-s - Print out the stacktrace for all exceptions.
215+
-S - Print out the full (very verbose) stacktrace for all exceptions.
216+
-t - Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.
217+
-U - Refresh the state of dependencies.
218+
-v - Shows the version info.
219+
-w - Set log level to warn.
220+
-x - Specify a task to be excluded from execution.\
225221
"
226222
COMPREPLY=( $(compgen -W "$args" -- "$cur") )
227223
}
@@ -405,7 +401,7 @@ _gradle() {
405401

406402
# Remove description ("[:space:]" and after) if only one possibility
407403
if [[ ${#COMPREPLY[*]} -eq 1 ]]; then
408-
COMPREPLY=( ${COMPREPLY[0]%% *} )
404+
COMPREPLY=( ${COMPREPLY[0]%% *} )
409405
fi
410406

411407
return 0

gradle-completion.bash.template

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ __gradle-long-options() {
7979
local cur
8080
_get_comp_words_by_ref -n : cur
8181

82-
local args="\
83-
{{GENERATED_BASH_LONG_OPTIONS}}\
84-
"
82+
local args="{{GENERATED_BASH_LONG_OPTIONS}}"
8583

8684
COMPREPLY=( $(compgen -W "$args" -- "$cur") )
8785
}
@@ -90,9 +88,7 @@ __gradle-properties() {
9088
local cur
9189
_get_comp_words_by_ref -n : cur
9290

93-
local args="\
94-
{{GENERATED_GRADLE_PROPERTIES}}\
95-
"
91+
local args="{{GENERATED_GRADLE_PROPERTIES}}"
9692
COMPREPLY=( $(compgen -W "$args" -- "$cur") )
9793
return 0
9894
}
@@ -102,7 +98,7 @@ __gradle-short-options() {
10298
_get_comp_words_by_ref -n : cur
10399

104100
local args="\
105-
{{GENERATED_BASH_SHORT_OPTIONS}}\
101+
{{GENERATED_BASH_SHORT_OPTIONS}}\
106102
"
107103
COMPREPLY=( $(compgen -W "$args" -- "$cur") )
108104
}
@@ -286,7 +282,7 @@ _gradle() {
286282

287283
# Remove description ("[:space:]" and after) if only one possibility
288284
if [[ ${#COMPREPLY[*]} -eq 1 ]]; then
289-
COMPREPLY=( ${COMPREPLY[0]%% *} )
285+
COMPREPLY=( ${COMPREPLY[0]%% *} )
290286
fi
291287

292288
return 0

0 commit comments

Comments
 (0)