Feature request: ability to specify file of files to format
If you try to run ktfmt's CLI over the find output of a large codebase, you can eventually exceed the maximum number of arguments. It would be great if these could be stored in a file and fed to the CLI via alternative parameter.
tooling/scripts/format.sh: line 23: ./config/bin/ktfmt: Argument list too long
As a workaround, does something like the following work?
find $DIR -name \*.kt | xargs tooling/scripts/format.sh
Sorry for the delay! That does indeed work 👍
It's not documented apparently, but if the only argument you pass is @file ktfmt takes what would normally be its command line arguments from file, one argument per line. So what would be
> ktfmt --google-style --dry-run some/dir/file1.kt some/other/dir/file2.kt build.gradle.kts ...
will do the same as
> cat args
--google-style
--dry-run
some/dir/file1.kt
some/other/dir/file2.kt
build.gradle.kts
...
> ktfmt @args
Introduced in this commit.
It looks like this has been fixed. Can someone close the issue?