Skip to content

Commit 4673919

Browse files
docs: Document package options
1 parent 9416b3b commit 4673919

File tree

5 files changed

+75
-1
lines changed

5 files changed

+75
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Collate:
6969
'io.R'
7070
'nest.R'
7171
'nested-to-tree.R'
72+
'options.R'
7273
'parse.R'
7374
'reindent.R'
7475
'token-define.R'

R/options.R

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#' Package options
2+
#'
3+
#' These options can be set via [options()] and queried via [getOption()].
4+
#' For this, add a `styler.` prefix (the package name and a dot) to the option name.
5+
#' Example: for an option `foo`, use `options(styler.foo = value)` to set it
6+
#' and `getOption("styler.foo")` to retrieve the current value.
7+
#' An option value of `NULL` means that the default is used.
8+
#'
9+
#' @usage NULL
10+
#' @format NULL
11+
#'
12+
#' @name styler_options
13+
#'
14+
#' @examplesIf FALSE
15+
#' getOption("styler.ignore_alignment")
16+
#' options(
17+
#' styler.ignore_alignment = TRUE,
18+
#' styler.quiet = TRUE
19+
#' )
20+
#' getOption("styler.ignore_alignment")
21+
#'
22+
#' @section Options for the styler package:
23+
#'
24+
#' - `styler.addins_style_transformer`: character. The name of the style transformer to use in the addins.
25+
#' - `styler.cache_name`: character. The name of the styler cache to use.
26+
#' - `styler.cache_root`: character. The directory where the cache files are stored.
27+
#' - `styler.colored_print.vertical`: logical. It decides whether or not the output should be colored with
28+
#' `prettycode::highlight()`.
29+
#' - `styler.ignore_alignment`: logical. If `TRUE`, alignment, when detected, is ignored.
30+
#' - `styler.ignore_start`, `styler.ignore_stop`: character. Regular expressions to ignore lines that match them.
31+
#' - `styler.quiet`: logical. It decides whether or not to print an informative message about what the
32+
#' function is doing. If `TRUE`, no output is printed.
33+
#' - `styler.test_dir_writable`: logical. If `TRUE`, the package tests whether the directory is writable.
34+
NULL

R/zzz.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
op <- options()
77
op.styler <- list(
88
styler.addins_style_transformer = "styler::tidyverse_style()",
9-
styler.cache_root = NULL,
109
styler.cache_name = styler_version,
10+
styler.cache_root = NULL,
1111
styler.colored_print.vertical = TRUE,
1212
styler.ignore_alignment = FALSE,
1313
styler.ignore_start = .default_ignore_start,

_pkgdown.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ reference:
1111
- style_pkg
1212
- style_dir
1313
- styler_addins
14+
- styler_options
1415
- title: "Fine-tune styling"
1516
desc: "Customize style guides"
1617
- contents:

man/styler_options.Rd

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)