draw_path_tree | R Documentation |
Pretty-prints a character vector of hierarchical paths as a tree. Uses Unicode box drawing characters to draw the nesting structure.
draw_path_tree(paths, quiet = FALSE)
paths |
A character vector of paths as returned by |
quiet |
Whether or not to suppress drawing the directory tree. |
This function is the equivalent of fs::dir_tree()
for an artificial/fictional path hierarchy. To print a tree of an actual filesystem path hierarchy, it's
recommended to rely on fs::dir_tree()
which additionally colorizes the output based on real filesystem information. Apart from that, the algorithm to draw
the tree is the same.
paths
, invisibly.
Other path functions:
flatten_path_tree()
,
path_mod_time()
# using an artificial/fictional path hierarchy
list("root_dir" = list("subdir1",
"subdir2" = list("file1.ext"),
"file2.ext")) |>
pal::flatten_path_tree() |>
pal::draw_path_tree()
# using an actual path hierarchy
fs::path_package("dplyr") |>
fs::dir_ls(recurse = TRUE) |>
pal::draw_path_tree()
# to get colorized output, use `fs::dir_tree()` instead
fs::path_package("dplyr") |> fs::dir_tree()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.