Description Usage Arguments Value See Also Examples
Reads text files with readLines
and performs a diff on the
resulting character vectors.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | diffFile(target, current, ...)
## S4 method for signature 'ANY'
diffFile(
target,
current,
mode = gdo("mode"),
context = gdo("context"),
format = gdo("format"),
brightness = gdo("brightness"),
color.mode = gdo("color.mode"),
word.diff = gdo("word.diff"),
pager = gdo("pager"),
guides = gdo("guides"),
trim = gdo("trim"),
rds = gdo("rds"),
unwrap.atomic = gdo("unwrap.atomic"),
max.diffs = gdo("max.diffs"),
disp.width = gdo("disp.width"),
ignore.white.space = gdo("ignore.white.space"),
convert.hz.white.space = gdo("convert.hz.white.space"),
tab.stops = gdo("tab.stops"),
line.limit = gdo("line.limit"),
hunk.limit = gdo("hunk.limit"),
align = gdo("align"),
style = gdo("style"),
palette.of.styles = gdo("palette"),
frame = par_frame(),
interactive = gdo("interactive"),
term.colors = gdo("term.colors"),
tar.banner = NULL,
cur.banner = NULL,
strip.sgr = gdo("strip.sgr"),
sgr.supported = gdo("sgr.supported"),
extra = list()
)
|
target |
character(1L) or file connection with read capability; if character should point to a text file |
current |
like |
... |
unused, for compatibility of methods with generics |
mode |
character(1L), one of:
|
context |
integer(1L) how many lines of context are shown on either side
of differences (defaults to 2). Set to |
format |
character(1L), controls the diff output format, one of:
Defaults to “auto”. See |
brightness |
character, one of “light”, “dark”,
“neutral”, useful for adjusting color scheme to light or dark
terminals. “neutral” by default. See |
color.mode |
character, one of “rgb” or “yb”.
Defaults to “yb”. “yb” stands for “Yellow-Blue” for
color schemes that rely primarily on those colors to style diffs.
Those colors can be easily distinguished by individuals with
limited red-green color sensitivity. See |
word.diff |
TRUE (default) or FALSE, whether to run a secondary word
diff on the in-hunk differences. For atomic vectors setting this to
FALSE could make the diff slower (see the |
pager |
one of “auto” (default), “on”,
“off”, a “auto” and “on” are the same, except that in non-interactive
mode “auto” is equivalent to “off”. “off” will always
send output to the console. If “on”, whether the output
actually gets routed to the pager depends on the pager Depending on your system configuration different styles and corresponding
pagers will get selected, unless you specify a If See |
guides |
TRUE (default), FALSE, or a function that accepts at least two
arguments and requires no more than two arguments. Guides
are additional context lines that are not strictly part of a hunk, but
provide important contextual data (e.g. column headers). If TRUE, the
context lines are shown in addition to the normal diff output, typically
in a different color to indicate they are not part of the hunk. If a
function, the function should accept as the first argument the object
being diffed, and the second the character representation of the object.
The function should return the indices of the elements of the
character representation that should be treated as guides. See
|
trim |
TRUE (default), FALSE, or a function that accepts at least two
arguments and requires no more than two arguments. Function should compute
for each line in captured output what portion of those lines should be
diffed. By default, this is used to remove row meta data differences
(e.g. |
rds |
TRUE (default) or FALSE, if TRUE will check whether
|
unwrap.atomic |
TRUE (default) or FALSE. Relevant primarily for
|
max.diffs |
integer(1L), number of differences (default 50000L)
after which we abandon the |
disp.width |
integer(1L) number of display columns to take up; note that
in “sidebyside” |
ignore.white.space |
TRUE or FALSE, whether to consider differences in horizontal whitespace (i.e. spaces and tabs) as differences (defaults to TRUE). |
convert.hz.white.space |
TRUE or FALSE, whether modify input strings
that contain tabs and carriage returns in such a way that they display as
they would with those characters, but without using those
characters (defaults to TRUE). The conversion assumes that tab stops are
spaced evenly eight characters apart on the terminal. If this is not the
case you may specify the tab stops explicitly with |
tab.stops |
integer, what tab stops to use when converting hard tabs to spaces. If not integer will be coerced to integer (defaults to 8L). You may specify more than one tab stop. If display width exceeds that addressable by your tab stops the last tab stop will be repeated. |
line.limit |
integer(2L) or integer(1L), if length 1 how many lines of
output to show, where |
hunk.limit |
integer(2L) or integer (1L), how many diff hunks to show.
Behaves similarly to |
align |
numeric(1L) between 0 and 1, proportion of
words in a line of |
style |
“auto”, a |
palette.of.styles |
|
frame |
an environment to use as the evaluation frame for the
|
interactive |
TRUE or FALSE whether the function is being run in
interactive mode, defaults to the return value of
|
term.colors |
integer(1L) how many ANSI colors are supported by the
terminal. This variable is provided for when
|
tar.banner |
character(1L), language, or NULL, used to generate the
text to display ahead of the diff section representing the target output.
If NULL will use the deparsed |
cur.banner |
character(1L) like |
strip.sgr |
TRUE, FALSE, or NULL (default), whether to strip ANSI CSI SGR sequences prior to comparison and for display of diff. If NULL, resolves to TRUE if 'style' resolves to an ANSI formatted diff, and FALSE otherwise. The default behavior is to avoid confusing diffs where the original SGR and the SGR added by the diff are mixed together. |
sgr.supported |
TRUE, FALSE, or NULL (default), whether to assume the standard output device supports ANSI CSI SGR sequences. If TRUE, strings will be manipulated accounting for the SGR sequences. If NULL, resolves to TRUE if 'style' resolves to an ANSI formatted diff, and to 'crayon::has_color()' otherwise. This only controls how the strings are manipulated, not whether SGR is added to format the diff, which is controlled by the 'style' parameter. This parameter is exposed for the rare cases where you might wish to control string manipulation behavior directly. |
extra |
list additional arguments to pass on to the functions used to
create text representation of the objects to diff (e.g. |
a Diff
object; see diffPrint
.
diffPrint
for details on the diff*
functions,
diffObj
, diffStr
,
diffChr
to compare character vectors directly,
ses
for a minimal and fast diff
1 2 3 4 5 6 7 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.