#!/usr/bin/env Rscript

cli::cli_h1("Format package with styler")

summary_styler <- styler::style_pkg(include_roxygen_examples = FALSE)

if (!any(summary_styler$changed, na.rm = TRUE)) {
  cli::cli_alert_success("No changes.")
  quit(save = "no", status = 0, runLast = FALSE)
}

cli::cli_alert_danger("Some files have been changed. Please add and commit them.")
quit(save = "no", status = 1, runLast = FALSE)
