Skip to contents

Primitive parsing of command line arguments

Usage

cmd_get_value(args, pre)

cmd_has(args, has)

cmd_parse_date(args, pre = "--date=")

Arguments

args

Character vector. Returned by base::commandArgs(TRUE).

pre

String. Command line prefix to retrieve value from.

has

Character vector. Arguments to be checked for presence in the command line arguments.

Examples

args = c( "--date=2022-11-20", "--second" )
cmd_get_value(args, "--date=")
#> [1] "2022-11-20"
cmd_parse_date(args)
#> [1] "2022-11-20"
cmd_has(args, "--second")
#> [1] TRUE