Tests whether a command-line interface (CLI) tool is found on the system's
PATH
and optionally returns the executable's filesystem path.
Arguments
- cmd
System command to invoke the CLI tool. A character scalar.
- get_cmd_path
Whether or not to return the filesystem path to the CLI tool. If
FALSE
, a boolean is returned indicating if the CLI tool is found on the system or not.- force_which
If set to
TRUE
,base::Sys.which()
, which relies on the system commandwhich
, will be used instead ofcommand -v
to determine the availability ofcmd
on Unix-like systems. On Windows,base::Sys.which()
is used in any case.command -v
is generally recommended for bourne-like shells and therefore is the default on Linux, macOS and other Unixes.
Value
A logical scalar if get_cmd_path = FALSE
, otherwise the filesystem path to the cmd
executable.
See also
Other system interaction functions:
assert_cli()