r-lib / styler

Non-invasive pretty printing of R code
https://styler.r-lib.org
Other
725 stars 71 forks source link

question: could I use this tool on the command line? #1155

Closed ssh352 closed 10 months ago

ssh352 commented 10 months ago

similar to clang-format? to format a R script to a formatted R script?

Thanks

lorenzwalthert commented 10 months ago

There is no command this package exports (I don't know if R has this ability in general to easily package CLI programs), but you can do Rscript -e "styler::style_file(commandArgs(trailingOnly = TRUE))" path/to/file path/to/file.