Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Input & Output check to CLI #17311

Merged
merged 14 commits into from
Mar 24, 2025
Merged

Add Input & Output check to CLI #17311

merged 14 commits into from
Mar 24, 2025

Conversation

rudiv
Copy link
Contributor

@rudiv rudiv commented Mar 20, 2025

Throw an error if the input and output file for the CLI are identical.

Throw an error if the input and output file for the CLI are identical.
@rudiv rudiv requested a review from a team as a code owner March 20, 2025 19:57
@philipp-spiess
Copy link
Member

Awesome, thank you so much 🙇

@RobinMalfait RobinMalfait enabled auto-merge (squash) March 24, 2025 10:34
@@ -95,6 +95,15 @@ export async function handle(args: Result<ReturnType<typeof options>>) {
}
}

// Check if the input and output file paths are identical, otherwise return an
// error to the user.
if (args['--input'] === args['--output']) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we merge this I want to check 1 small thing. Commenting here to prevent auto merge from happening.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So one edge case here is that - can be used by both the --input and --output, e.g.: --input - --output -. The - means "use stdin and stdout respectively". In this case we don't want the error to show up.

Added a failing integration test + a fix for this.

(I also ran prettier in a separate commit)

@RobinMalfait RobinMalfait disabled auto-merge March 24, 2025 11:00
@RobinMalfait RobinMalfait merged commit baa016a into tailwindlabs:main Mar 24, 2025
@RobinMalfait
Copy link
Member

Thanks you! These changes will be available in the next release.

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.

3 participants