ArgParser-class: An S4 class to represent a command line arguments parser.

Description Usage Arguments Value Methods (by generic) Slots Examples

Description

An S4 class to represent a command line arguments parser.

Usage

1
2
## S4 method for signature 'ArgParser'
initialize(.Object, desc = "", prog = "")

Arguments

.Object

A prototyped object of class ArgParser.

desc

A description shown in usage. desc with length > 1 will be printed in seperated lines.

prog

A program name shown in usage, if not set, will default to the value of "--file=" flag given in commandArg().

Value

An S4 object of class ArgParser.

Methods (by generic)

Slots

desc

A description shown in usage. desc with length > 1 will be printed in seperated lines.

prog

A program name shown in usage, if not set, will default to the value of "--file=" flag given in commandArg().

flags

A list of defined flag arguments.

flags_alias

A character vector of defined flag alias.

flags_isOptional

A logical vector indicating wheather a flag is optional or not.

switches_logic

A logical vector of defined logical switch arguments.

switches_any

A list of defined ad-hoc switch arguments.

switches_alias

A character vector of defined switch alias.

opt

A character vector of defined positional arguments.

opt_narg

An integer vector indicating the number of positinal arguments to consume for each opt.

opt_nrequired

An integer vector indicating the number of required positional arguments to consume for each opt.

help

A character vector of defined help message for each argument.

Examples

1
2
p1 <- ArgParser(desc="a test description", prog="test.R")
p2 <- ArgParser(desc=c("a test description", "that can have multiple lines"))

everdark/ArgParser documentation built on May 13, 2017, 10:04 p.m.