-
Notifications
You must be signed in to change notification settings - Fork 3
no rust error msg and intro for pkg style printout #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
package_root <- dirname(package_root) | ||
if (strsplit(package_root, split = .Platform$file.sep) |> length() == 1) { | ||
parent_dir <- dirname(package_root) | ||
if (parent_dir == package_root) { # Reached root without finding DESCRIPTION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this comparison behave nicely on Windows? I wouldn't want people to need to create two different styling scripts for Windows and Unix platforms because of backwards slashes.
# Format | ||
|
||
# Define ANSI Color Codes and Unicode Symbols | ||
green_tick <- "\u001B[32m\u2714\u001B[0m" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
METAL
Co-authored-by: Konrad Pagacz <[email protected]>
#' | ||
#' @export | ||
style_pkg <- function(path = ".", | ||
config_file = "tergo.toml", | ||
configuration = list(), | ||
force = FALSE, | ||
extensions = c(".R", ".r")) { | ||
extensions = c(".R", ".r"), | ||
verbose = interactive()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever.
Co-authored-by: Konrad Pagacz <[email protected]>
Co-authored-by: Konrad Pagacz <[email protected]>
@@ -72,7 +72,15 @@ fn format_code(source_code: &str, configuration: extendr_api::List) -> String { | |||
.unwrap_or(default_config.insert_newline_in_quote_call.0), | |||
); | |||
|
|||
tergo_lib::tergo_format(source_code, Some(&config)).unwrap() | |||
|
|||
match tergo_lib::tergo_format(source_code, Some(&config)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, the issue of panics stemming from wrong configuration values still persists. It's all lines 15-75.
We return a list not a string for format_code, the first list element is a status.
PS. We not want to use |> as it implies we expect at least R 4.1
Add a prototype nice style_pkg printout, I will polish it