About --list-presets and 'condition'

Consider the following CMakePresets.json file:

{
  "version": 6,
  "configurePresets":[
  {
    "name":"c1",
    "condition": {
      "type": "equals",
      "lhs": "$env{__UNFULLFILLED__}",
      "rhs": "set_value"
    }
  },
  {
    "name": "c2"
  }],
  "workflowPresets": [
  {
    "name": "p1",
      "steps": [
        { "type": "configure", "name": "c1" }
      ]
    },
    {
      "name": "p2",
      "steps": [
        { "type": "configure", "name": "c2" }
      ]
    }
  ]
}

The ‘condition’ correctly masks the c1 configure preset.

$ cmake --list-presets=all
Available configure presets:

  "c2"

Available workflow presets:

  "p1"
  "p2"


But the workflow preset p1, is visible, but actually also disabled:

$ cmake --workflow --preset p1
CMake Error: Cannot use disabled configure preset in /home/max/tests/cmake_presets: "c1"``  

There also is also no way to see all presets and their state and reason, why they might be disabled.

I think it could be improved two-fold:

  1. only show presets actually available (e.g. hide ‘p1’ workflow in this case)
  2. add another option (–list-all-presets | --list-presets=all-defined ?? ) to show reason of unavailability.
$ cmake --list-presets=all
Available configure presets:

  "c2"

Available workflow presets:

  "p2"

$ cmake --list-presets=all-defined
All configure presets:

  "c1" - Unavailable: condition evaluated to false: {"lhs":"$env{__UNFULLFILLED__}","rhs":"set_value","type":"equals"}
  "c2"

All workflow presets:

  "p1" - Unavailable: step 1: configure preset "c1": condition evaluated to false: {"lhs":"$env{__UNFULLFILLED__}","rhs":"set_value","type":"equals"}
  "p2"

So the questions are

  • Shall workflows also be hidden if they are disabled?
  • What is a good cli argument to show all workflows and why they are not available?

Im am looking forward to your feedback!