Skip to content

devOpifex/cl.args

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cl.args

Parse command line arguments.

Installation

# install.packages("pak")
pak::pak("devOpifex/cl.args")

Example

#!/usr/bin/Rscript
library(cl.args)

cl <- cl.make(
  name = "Test",
  version = "1.0.0"
)

name <- cl$str("name", "Bob", "A name")
n <- cl$int(
  name = "n",
  default = 42, 
  description = "An age"
)

# prints help (and quits) if -help is passed
cl$help()

erratum::resolve(n)
erratum::resolve(m)

cat(sprintf("Hello %s, you are %d years old.\n", name, n))

Which you can then call like ./script.R

Accepts arguments as:

  • -name=Bob
  • -name Bob
  • -name Only for booleans
  • -help Prints help and quits, autogenerated

About

Parse comand line arguments in R

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages