Task-specific switches

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?

Why are global switches documented in the User Guide and in “gradle --help” but the task-specific switch syntax is entirely ignored?

Task-specific switches are currently an internal feature and not meant for public consumption. So far, the “tasks” task is the only task that uses such a switch (–all).

That syntax message is just wrong, as it does not allow for “gradle tasks --help”.

–help is a global switch, unrelated to “tasks”.

Sorry, I wrote the wrong switch. What I meant to say, regarding “USAGE: gradle [option…] [task…]”, was:

That syntax message is just wrong, as it does not allow for “gradle tasks --all”.

If the feature is not meant for end-user coding, the “-all” switch is meant for end-user usage, and the documentation and syntax messages of Gradle are wrong on that account.