elye
09/24/2020, 3:20 PM./ktlint -F app/src/**/*.kt
from my Android project root directory. All works and it corrected the file format. However it is not following AndroidStudio default rule. So I tried ./ktlint --android applyToIDEA -F app/src/**/*.kt
, but it crashes as below.
Exception in thread "main" picocli.CommandLine$UnmatchedArgumentException: Unknown options: -F, app/src/androidTest/java/com/example/pdfreader/ExampleInstrumentedTest.kt, app/src/main/java/com/example/pdfreader/FileDownloader.kt, app/src/main/java/com/example/pdfreader/MainActivity.kt, app/src/main/java/com/example/pdfreader/PageAdaptor.kt, app/src/main/java/com/example/pdfreader/PageHolder.kt, app/src/main/java/com/example/pdfreader/PdfReader.kt, app/src/test/java/com/example/pdfreader/ExampleUnitTest.kt
at picocli.CommandLine$Interpreter.parse(CommandLine.java:7283)
at picocli.CommandLine$Interpreter.processArguments(CommandLine.java:7357)
at picocli.CommandLine$Interpreter.parse(CommandLine.java:7257)
at picocli.CommandLine$Interpreter.parse(CommandLine.java:7147)
at picocli.CommandLine.parseArgs(CommandLine.java:836)
at com.pinterest.ktlint.Main.main(Main.kt:55)
What did I do wrong? I tried remove the -F
, it is not working as well? I think I might have miss something…. any help? 🙏Rob Elliot
09/24/2020, 5:27 PM./ktlint -F "app/src/**/*.kt"
Note the quotation marks - I guess without them your shell is expanding the glob expression before calling ktlint?romtsn
09/24/2020, 6:07 PMapplyToIDEA
is actually a cli subcommand that applies ktlint’s code style to your .idea/codeStyles
so has nothing to do with formattingromtsn
09/24/2020, 6:08 PMktlint applyToIDEA
separately and then run your format commandromtsn
09/24/2020, 6:09 PMelye
09/25/2020, 2:43 AMapplyToIDEA
is actually adding KtLint code style to Android Studio. Is there the other way round? i.e applying Android Studio default/project rule to Ktlint?tapchicoma
09/25/2020, 7:29 AM--android
cli swith uses Android flavor of code styletapchicoma
09/25/2020, 7:29 AM.editorconfig
file