You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.3 KiB
71 lines
2.3 KiB
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/cloc-call.r
|
|
\name{cloc_call}
|
|
\alias{cloc_call}
|
|
\alias{cloc_help}
|
|
\alias{cloc_version}
|
|
\alias{cloc_os}
|
|
\title{Call \code{cloc.pl} directly with granular control over options}
|
|
\usage{
|
|
cloc_call(args = character(), echo = TRUE, ...)
|
|
|
|
cloc_help(echo = FALSE)
|
|
|
|
cloc_version(echo = FALSE)
|
|
|
|
cloc_os(echo = FALSE)
|
|
}
|
|
\arguments{
|
|
\item{args, }{character vector, arguments to the command. They will be escaped
|
|
via \code{\link[base:shQuote]{base::shQuote()}}.}
|
|
|
|
\item{echo}{echo Whether to print the standard output and error to the screen.
|
|
Note that the order of the standard output and error lines are not necessarily
|
|
correct, as standard output is typically buffered.}
|
|
|
|
\item{...}{other options/parameters passed on to \code{\link[processx:run]{processx::run()}}}
|
|
}
|
|
\value{
|
|
the structure returned by \code{\link[processx:run]{processx::run()}} (a list with four elements).
|
|
}
|
|
\description{
|
|
It is nigh impossible to predict all use-cases for the \code{cloc.pl} acript and
|
|
create associated R functions for them. To that end, this function provides direct
|
|
access to the script and enables direct passing of command-line parameters
|
|
via \code{\link[processx:run]{processx::run()}}.
|
|
}
|
|
\section{Caveat utilitor}{
|
|
|
|
As indicated, this is an lower-level function providing granular control over
|
|
the options for \code{cloc.pl}. You are invoking an operating system command-line
|
|
and need to read the \code{cloc.pl} help very carefully as --- unlike the higher-level
|
|
functions -- there are no "guide railss" provided to do helpful things such as e
|
|
nsure you do not clobber files in a given directory.
|
|
|
|
\code{\link[processx:run]{processx::run()}} supports "callback functions" to make it easier to deal with
|
|
stdout and stderr and you may need to make use of those depending on the how
|
|
you are calling the underlying script.
|
|
}
|
|
|
|
\examples{
|
|
# Get help on the parameters `cloc.pl` supports
|
|
cloc_call("--help", echo_cmd=TRUE, echo=TRUE)
|
|
|
|
# or use the helper version of the above
|
|
cloc_help()
|
|
|
|
# show the OS type
|
|
cloc_call("--show-os")
|
|
|
|
# shortcut equivalent
|
|
cloc_os()
|
|
|
|
# retrieve the OS type
|
|
trimws(cloc_call("--show-os")$stdout)
|
|
|
|
# shortcut of the above with no echo and only returning trimmed stdout
|
|
cloc_os()
|
|
|
|
# get version of cloc.pl script provided with the package
|
|
cloc_version()
|
|
}
|
|
|