Skip to content

Allow false in compose CLI argument - #3670

Open
ChihweiLHBird wants to merge 1 commit into
spinframework:mainfrom
ChihweiLHBird:zhiwei/compose-false
Open

Allow false in compose CLI argument#3670
ChihweiLHBird wants to merge 1 commit into
spinframework:mainfrom
ChihweiLHBird:zhiwei/compose-false

Conversation

@ChihweiLHBird

Copy link
Copy Markdown
Contributor

Allow compose to be passed as a false.

  • --compose=false (plus boolish spellings like 0, no, off) to actually select ComposeMode::Skip, which is previously unreachable from the CLI
  • Bare --compose still works, defaulting to true via default_missing_value
  • require_equals = true prevents --compose false from swallowing the positional registry reference as the flag's value

Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
@itowlson

Copy link
Copy Markdown
Collaborator

I am confused. What is the purpose here?

@ChihweiLHBird

ChihweiLHBird commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

I am confused. What is the purpose here?

This CLI argument is always true regardless how a user configures it, even if they try to configure it as a false. This change allows users to set it to false if they want.

@itowlson

Copy link
Copy Markdown
Collaborator

But they can just leave it out. Flags like --build usually don't take a value, it's presence or non-presence. You express false by non-presence. What's the use case in which someone needs it to be present but false?

@ChihweiLHBird

ChihweiLHBird commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

But they can just leave it out. Flags like --build usually don't take a value, it's presence or non-presence. You express false by non-presence. What's the use case in which someone needs it to be present but false?

It defaults to true so when non-presence it's still true... This is controlled by default_value_t.

I can also remove the default_value_t to achieve the behavior that presence represents true or non-presence representing false, but this will be a breaking change for most people who don't use this argument.

The current PR can avoid breaking change, but the alternative might be more correct and simple. Either way works, what do you think?

@itowlson

Copy link
Copy Markdown
Collaborator

Oh! I think I have confused myself. Sorry! And thanks for patiently clarifying.

@fibonacci1729 I think this was a flag that you added. I recall choosing this over --skip-compose to avoid awkward double negatives, and that we wanted to default to pre-composing so it had to default true, but is Zhiwei correct that it can't currently be turned off (i.e. push an app non-pre-composed)? Could this be a regression from the Clap 4 migration?

@ChihweiLHBird

Copy link
Copy Markdown
Contributor Author

@itowlson no problem, and thanks for looking into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants