Skip to content

Added support for generic NativeCmd step - #949

Merged
nedtwigg merged 2 commits into
diffplug:mainfrom
tisoft:generic_native_cmd
Sep 27, 2021
Merged

Added support for generic NativeCmd step#949
nedtwigg merged 2 commits into
diffplug:mainfrom
tisoft:generic_native_cmd

Conversation

@tisoft

Copy link
Copy Markdown
Contributor

Allows to call locally installed binaries to format files

@tisoft

Copy link
Copy Markdown
ContributorAuthor

Would like to use this, to call a custom formatter, that is installed locally, but can't be added as a "real" formatter into spotless.

TODO: Support writing the unformatted string to a temp file and read it back from another (or the same) file

@nedtwiggnedtwigg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cool feature, needs docs and changelog entries (root and plugin-maven).

Comment threadlib/src/main/java/com/diffplug/spotless/generic/NativeCmdStep.java Outdated
Comment threadlib/src/main/java/com/diffplug/spotless/generic/NativeCmdStep.java Outdated
@nedtwigg

nedtwigg commented Sep 24, 2021

Copy link
Copy Markdown
Member

TODO: Support writing the unformatted string to a temp file and read it back from another (or the same) file

This feature is best left unimplemented, imo. stdin/stdout are perfectly suited for this purpose. Unless you absolutely, unavoidably need filebased-IO for a usecase you have right now, I think we're better off leaving this out. 100% guarantee people waste hours fiddling with the filename, whether its local or relative, tools that don't flush filesystem cache, etc, not to mention performance.

@tisoft

Copy link
Copy Markdown
ContributorAuthor
  • Added CHANGES.md entries
  • Added doc in README.md
  • Incorporated review comments

@nedtwigg

Copy link
Copy Markdown
Member

Please merge the latest origin/main into this PR. That should fix CI, at which point I can merge and release.

@tisoft

Copy link
Copy Markdown
ContributorAuthor

@nedtwigg rebased against main and fixed one copyright date. The test failure seems unrelated to me.

Comment threadlib/src/main/java/com/diffplug/spotless/generic/NativeCmdStep.java Outdated
@nedtwigg

Copy link
Copy Markdown
Member

Agree re: test faillure. I would merge if there wasn't low-hanging fruit re: the absolute path.

@nedtwigg
nedtwigg merged commit 12aac3c into diffplug:mainSep 27, 2021
@tisoft
tisoft deleted the generic_native_cmd branch September 27, 2021 05:55
@nedtwigg

Copy link
Copy Markdown
Member

Published in plugin-maven 2.14.0.

@carhartlcarhartl mentioned this pull request Oct 9, 2021
carhartl added a commit to carhartl/spotless that referenced this pull request Oct 11, 2021
carhartl added a commit to carhartl/spotless that referenced this pull request Oct 11, 2021
Sign up for freeto 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

@tisoft@nedtwigg