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

cmd/shfmt: document when --filename is needed for EditorConfig support #1058

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

mvdan
Copy link
Owner

@mvdan mvdan commented Feb 13, 2024

(see commit message)

Fixes #1055.

@mvdan
Copy link
Owner Author

mvdan commented Feb 13, 2024

cc @tcrawford-figure

@mvdan mvdan force-pushed the shfmt-filename-editorconfig branch from 0be84b7 to db0b4ba Compare February 13, 2024 22:22
EditorConfig files are found based on a script's absolute path,
and the EditorConfig patterns are usually filename-based as well.

When formatting standard input, there is no known filename or path.
Sometimes there's a need to format a stream of bytes in memory
without having to place them on a file, which is why we support stdin.

We added the --filename flag for this purpose a long time ago,
and the tests already verified this fact - we just hadn't documented it.

While here, also add a test case for absolute paths,
and make the man page flags consistently use double dashes.

Fixes #1055.
@mvdan mvdan force-pushed the shfmt-filename-editorconfig branch from db0b4ba to 6562761 Compare February 13, 2024 22:26
@mvdan mvdan merged commit df8fd14 into master Feb 13, 2024
16 checks passed
@mvdan mvdan deleted the shfmt-filename-editorconfig branch February 18, 2024 10:26
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.

cmd/shfmt: document how --filename relates to EditorConfig support
2 participants