Skip to content

Commit 2239e64

Browse files
authored
Move config functions to config.R (#2513)
And inline remaining functions from `utils-yaml.R` into `utils.R`
1 parent 6b85aa2 commit 2239e64

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

R/utils-yaml.R renamed to R/config.R

-16
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,3 @@ config_path <- function(pkg) {
5353
}
5454
cli::style_hyperlink(fs::path_file(config), paste0("file://", config))
5555
}
56-
57-
# print helper ------------------------------------------------------------
58-
59-
print_yaml <- function(x) {
60-
structure(x, class = "print_yaml")
61-
}
62-
#' @export
63-
print.print_yaml <- function(x, ...) {
64-
cat(yaml::as.yaml(x), "\n", sep = "")
65-
}
66-
67-
# IO ----------------------------------------------------------------------
68-
69-
write_yaml <- function(x, path) {
70-
write_lines(yaml::as.yaml(x), path = path)
71-
}

R/utils.R

+14
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,20 @@ section_id <- function(section) {
181181
xml2::xml_attr(h, "id")
182182
}
183183

184+
# yaml ------------------------------------------------------------
185+
186+
print_yaml <- function(x) {
187+
structure(x, class = "print_yaml")
188+
}
189+
#' @export
190+
print.print_yaml <- function(x, ...) {
191+
cat(yaml::as.yaml(x), "\n", sep = "")
192+
}
193+
194+
write_yaml <- function(x, path) {
195+
write_lines(yaml::as.yaml(x), path = path)
196+
}
197+
184198
# Helpers for testing -----------------------------------------------------
185199

186200
xpath_xml <- function(x, xpath) {
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)