fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
6d0cd3d9b
master
1# Gradle is a build system. 2# See: https://gradle.org 3 4function __fish_gradle_contains_build_file 5test -f build.gradle-o -f build.gradle.kts 6end 7 8function __fish_gradle_create_completion_cache_file 9set -l cache_dir( __fish_make_cache_dir gradle-completions) 10set -l md5Hash( __fish_md5 -s$argv [ 1 ] | string replace -r'.* = ' '' ) 11string trim --" $cache_dir / $md5Hash " 12end 13 14############################## 15# Configure Tasks Completion # 16############################## 17 18# Outside of a Project 19function __fish_gradle_get_default_task_completion 20if __fish_gradle_contains_build_file 21return 22end 23 24printf '%s\t%s\n' \ 25 buildEnvironment"Display buildscript dependencies" \ 26 components"Display components" \ 27 dependencies"Display dependencies" \ 28 dependencyInsight"Display insight of a given dependency" \ 29 dependentComponents"Display the dependent components" \ 30 help"Display help message" \ 31 init"Initialize new Gradle project" \ 32 model"Display configuration model" \ 33 projects"Display sub-projects" \ 34 properties"Display properties" \ 35 tasks"Display tasks" \ 36 wrapper"Generate Gradle wrapper files" 37end 38 39complete --command gw --command gradle --command gradlew\ 40 --exclusive\ 41 --arguments"(__fish_gradle_get_default_task_completion)" 42 43# Inside of a Project 44function __fish_gradle_get_task_completion 45if not __fish_gradle_contains_build_file 46return 47end 48 49set -l gradle_cache_file( __fish_gradle_create_completion_cache_file "{ $PWD }-tasks" ) 50if not test -f " $gradle_cache_file " -a -s " $gradle_cache_file " 51command gradle -q tasks --all2> /dev/null| string match --regex'^(?!-)[A-Za-z0-9:-]+(?: - .*)?$' | string replace' - ' \t > " $gradle_cache_file " 52end 53 54# return possible tasks 55string trim --< " $gradle_cache_file " 56end 57 58complete --command gw --command gradle --command gradlew\ 59 --condition __fish_gradle_contains_build_file\ 60 --exclusive\ 61 --arguments"(__fish_gradle_get_task_completion)" 62 63############################### 64# Configure Option Completion # 65############################### 66 67function __fish_gradle_get_console_completion 68printf '%s\t%s\n' \ 69 auto"Use 'rich' in console otherwise 'plain'" \ 70 plain"Disable color and rich output" \ 71 rich"Enable color and rich output" \ 72 verbose"Enable color, rich output, output task names and outcomes at the lifecycle log level" 73end 74 75function __fish_gradle_get_property_completion 76printf '%s\t%s\n' \ 77"org.gradle.cache.reserved.mb" "Reserve Gradle Daemon memory for operations" \ 78"org.gradle.caching" "Enable Gradle build cache" \ 79"org.gradle.console" "Set type of console output to generate (plain, auto, rich, verbose)" \ 80"org.gradle.daemon.debug" "Enable debug Gradle Daemon" \ 81"org.gradle.daemon.idletimeout" "Kill Gradle Daemon after" \ 82"org.gradle.debug" "Enable debug Gradle Client" \ 83"org.gradle.jvmargs" "Set JVM arguments" \ 84"org.gradle.java.home" "Set JDK home dir" \ 85"org.gradle.logging.level" "Set default Gradle log level (quiet, warn, lifecycle, info, debug)" \ 86"org.gradle.parallel" "Enable parallel project builds (incubating)" \ 87"org.gradle.priority" "Set priority for Gradle worker processes (low, normal)" \ 88"org.gradle.warning.mode" "Set types of warnings to log (all, summary, fail, none)" \ 89"org.gradle.workers.max" "Set the number of workers Gradle is allowed to use" 90end 91 92function __fish_gradle_get_priority_completion 93printf '%s\t%s\n' \ 94 normal"Default process priority" \ 95 low"Low process priority" 96end 97 98function __fish_gradle_get_warning_mode_completion 99printf '%s\t%s\n' \ 100 all"Log all warnings" \ 101 summary"Suppress all warnings, log a summary at the end" \ 102 fail"Log all warnings and fail the build if there are any" \ 103 none"Suppress all warnings, including the summary at the end" 104end 105 106complete --command gw --command gradle --command gradlew\ 107 --long-option help\ 108 --short-option h --short-option'?' \ 109 --description'Show this help message' 110complete --command gw --command gradle --command gradlew\ 111 --long-option no-rebuild\ 112 --short-option a\ 113 --description'Do not rebuild project dependencies' 114complete --command gw --command gradle --command gradlew\ 115 --long-option build-file\ 116 --short-option b\ 117 --require-parameter\ 118 --description'Specify build file' 119complete --command gw --command gradle --command gradlew\ 120 --long-option build-cache\ 121 --description'Enable Gradle build cache' 122complete --command gw --command gradle --command gradlew\ 123 --long-option settings-file\ 124 --short-option c\ 125 --require-parameter\ 126 --description'Specify settings file' 127complete --command gw --command gradle --command gradlew\ 128 --long-option configure-on-demand\ 129 --description'Configure necessary projects only [incubating]' 130complete --command gw --command gradle --command gradlew\ 131 --long-option console\ 132 --exclusive\ 133 --description'Specify type of console output' \ 134 --arguments"(__fish_gradle_get_console_completion)" 135complete --command gw --command gradle --command gradlew\ 136 --long-option continue\ 137 --description'Continue task execution after task failures' 138complete --command gw --command gradle --command gradlew\ 139 --long-option system-prop\ 140 --short-option D\ 141 --exclusive\ 142 --description'Set system property of the JVM (e.g. -Dmyprop=myvalue)' \ 143 --arguments"(__fish_gradle_get_property_completion)" 144complete --command gw --command gradle --command gradlew\ 145 --long-option debug\ 146 --short-option d\ 147 --description'Log in debug mode (incl. normal stacktrace)' 148complete --command gw --command gradle --command gradlew\ 149 --long-option daemon\ 150 --description'Uses Gradle Daemon' 151complete --command gw --command gradle --command gradlew\ 152 --long-option foreground\ 153 --description'Start Gradle Daemon in foreground' 154complete --command gw --command gradle --command gradlew\ 155 --long-option gradle-user-home\ 156 --short-option g\ 157 --require-parameter\ 158 --description'Specify gradle user home directory' 159complete --command gw --command gradle --command gradlew\ 160 --long-option init-script\ 161 --short-option I\ 162 --require-parameter\ 163 --description'Specify initialization script' 164complete --command gw --command gradle --command gradlew\ 165 --long-option info\ 166 --short-option i\ 167 --description'Info log level' 168complete --command gw --command gradle --command gradlew\ 169 --long-option include-build\ 170 --require-parameter\ 171 --description'Include specified build in composite' 172complete --command gw --command gradle --command gradlew\ 173 --long-option dry-run\ 174 --short-option m\ 175 --description'Run builds with all task actions disabled' 176complete --command gw --command gradle --command gradlew\ 177 --long-option max-workers\ 178 --exclusive\ 179 --description'Configure number of concurrent workers' 180complete --command gw --command gradle --command gradlew\ 181 --long-option no-build-cache\ 182 --description'Disable Gradle build cache' 183complete --command gw --command gradle --command gradlew\ 184 --long-option no-configure-on-demand\ 185 --description'Disable use of configuration on demand [incubating]' 186complete --command gw --command gradle --command gradlew\ 187 --long-option no-daemon\ 188 --description'Disable Gradle daemon' 189complete --command gw --command gradle --command gradlew\ 190 --long-option no-parallel\ 191 --description'Disable parallel execution' 192complete --command gw --command gradle --command gradlew\ 193 --long-option no-scan\ 194 --description'Disable creation of build scan' 195complete --command gw --command gradle --command gradlew\ 196 --long-option offline\ 197 --description'Execute build without accessing network resources' 198complete --command gw --command gradle --command gradlew\ 199 --long-option project-prop\ 200 --short-option P\ 201 --exclusive\ 202 --description'Set project property for build script (e.g. -Pmyprop=myvalue)' 203complete --command gw --command gradle --command gradlew\ 204 --long-option project-dir\ 205 --short-option p\ 206 --require-parameter\ 207 --description'Specify start directory for Gradle' 208complete --command gw --command gradle --command gradlew\ 209 --long-option parallel\ 210 --description'Build projects in parallel' 211complete --command gw --command gradle --command gradlew\ 212 --long-option priority\ 213 --exclusive\ 214 --description'Specify scheduling priority for the Gradle daemon and all processes launched by it' \ 215 --arguments"(__fish_gradle_get_priority_completion)" 216complete --command gw --command gradle --command gradlew\ 217 --long-option profile\ 218 --description'Profile build execution time and generate report' 219complete --command gw --command gradle --command gradlew\ 220 --long-option project-cache-dir\ 221 --require-parameter\ 222 --description'Specify cache directory' 223complete --command gw --command gradle --command gradlew\ 224 --long-option quiet\ 225 --short-option q\ 226 --description'Error log level' 227complete --command gw --command gradle --command gradlew\ 228 --long-option refresh-dependencies\ 229 --description'Refresh dependencies state' 230complete --command gw --command gradle --command gradlew\ 231 --long-option rerun-tasks\ 232 --description'Ignore previously cached task results' 233complete --command gw --command gradle --command gradlew\ 234 --long-option full-stacktrace\ 235 --short-option S\ 236 --description'Print out full stacktrace' 237complete --command gw --command gradle --command gradlew\ 238 --long-option stacktrace\ 239 --short-option s\ 240 --description'Print out stacktrace' 241complete --command gw --command gradle --command gradlew\ 242 --long-option scan\ 243 --description'Creates build scan' 244complete --command gw --command gradle --command gradlew\ 245 --long-option status\ 246 --description'Show status of Gradle Daemon(s)' 247complete --command gw --command gradle --command gradlew\ 248 --long-option stop\ 249 --description'Stop Gradle Daemon(s)' 250complete --command gw --command gradle --command gradlew\ 251 --long-option continuous\ 252 --short-option t\ 253 --description'Enable continuous build' 254complete --command gw --command gradle --command gradlew\ 255 --long-option update-locks\ 256 --description'Perform a partial update of the dependency lock [incubating]' 257complete --command gw --command gradle --command gradlew\ 258 --long-option version\ 259 --short-option v\ 260 --description'Print version info.' 261complete --command gw --command gradle --command gradlew\ 262 --long-option warn\ 263 --short-option w\ 264 --description'Warn log level' 265complete --command gw --command gradle --command gradlew\ 266 --long-option warning-mode\ 267 --description'Specify warn mode' \ 268 --arguments"(__fish_gradle_get_warning_mode_completion)" 269complete --command gw --command gradle --command gradlew\ 270 --long-option write-locks\ 271 --description'Persists dependency resolution for locked configurations [incubating]'