How do I detect, in my “build.gradle”, the value of task-specific switches such as the “–all” switch to the “tasks” task?
My immediate use case is for overriding the “tasks” task, due to numerous inadequacies with the out-of-the-box task, but that doesn’t effect my question here. More generally, I would like to follow the example and use task-specific switches to modify task-behavior in an invocation-by-invocation way just like “-all” in “gradle tasks -all” does.
Why are global switches documented in the User Guide and in “gradle --help” but the task-specific switch syntax is entirely ignored? As documented: “USAGE: gradle [option…] [task…]” That syntax message is just wrong, as it does not allow for “gradle tasks --help”.
I have looked through the API and see no way way for my task to get the values of task-specific switches. For example, in my implementation of the “tasks” task, how can I detect that switch “–all” was set?