Skip to content

test: add early-exit tests#22

Merged
fabiospampinato merged 3 commits intoprettier:mainfrom
43081j:early-exit
Feb 9, 2025
Merged

test: add early-exit tests#22
fabiospampinato merged 3 commits intoprettier:mainfrom
43081j:early-exit

Conversation

@43081j
Copy link
Collaborator

@43081j 43081j commented Jan 28, 2025

These are copied from prettier. The following have been removed:

  • show detailed usage with --help l
  • show usage per option (e.g. --help tab-width)
  • throw error when usage requested for unknown option (e.g. --help foo)

The following have been changed:

  • throw error and show usage when called with no args
    • we do not currently show usage

cc @fabiospampinato

@fabiospampinato
Copy link
Collaborator

show detailed usage with --help l

Ok for simplicity let's not think about this now, especially as that doesn't seem to provide particularly interesting information for Prettier, it's 99% the same content that's in the help page.

But it has an interesting behavior, where for example they can show different help text for --color and --no-color, which is something we don't support at all anywhere, but also I'm not sure it's that useful.

I think it's fine to not implement this in v4, and if people complain I can add it back in the future.

show usage per option (e.g. --help tab-width)

Same as above.

throw error when usage requested for unknown option (e.g. --help foo)

yeah if that's not supported what would we throw an error for, I guess.

@fabiospampinato
Copy link
Collaborator

The following have been changed:

throw error and show usage when called with no args
we do not currently show usage

That seems fine, I don't know of another CLI that shows the help text in that scenario.

@fabiospampinato
Copy link
Collaborator

If you can rebase and update the tests about stderr it seems fine to merge this 👍

@43081j
Copy link
Collaborator Author

43081j commented Feb 2, 2025

have rebased and fixed stuff up

but i think i lost commits you did as i didnt realise you pushed here

@43081j 43081j reopened this Feb 2, 2025
@fabiospampinato fabiospampinato force-pushed the main branch 2 times, most recently from 988b7a6 to 67c31b2 Compare February 2, 2025 19:52
These are copied from prettier. The following have been removed:

- show detailed usage with `--help l`
- show usage per option (e.g. `--help tab-width`)
- throw error when usage requested for unknown option (e.g. `--help
  foo`)

The following have been changed:

- throw error and show usage when called with no args
  - we do not currently show usage
@fabiospampinato fabiospampinato merged commit f6d848a into prettier:main Feb 9, 2025
1 of 2 checks passed
@fabiospampinato
Copy link
Collaborator

Thanks!

@43081j 43081j deleted the early-exit branch February 9, 2025 17:36
@fabiospampinato
Copy link
Collaborator

I added a couple of more text to make sure all 3 main flags are considered incompatible with each other, and also for some flags that are considered not supported anymore at the moment.

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