#!/usr/bin/env Rscript

suppressMessages(library(ribiosUtils))
suppressMessages(library(ribiosArg))
scriptInit()

usage <- sprintf("%s -infile INFILE -outfile OUTFILE [-a Low Up] [-b] [-c Mid] [-d] [-e OPT]\
  Mandatory:\
    -infile: input file\
    -outfile: output file\
  Optional:\
    -a LOW UP: Two parameters expected\
    -b: Flag variable, no parameter expected\
    -c: One parameter expected\
    -d: Flag variable, no parameter expected\
    -e: accepts only following values: a, b, c", scriptName())

argParse(optargs="b a,2 c,1 d e", reqargs="infile outfile", usage=usage, strict=TRUE)
cat("infile:", argGet("infile"),"\n")
cat("outfile:", argGet("outfile"),"\n")
cat("c:", argGet("c"), "\n")
cat("a[1]:", argGetPos("a",1), "\n")
cat("a[2]:", argGetPos("a",2), "\n")
cat("b:", argPresent("b"), "\n")
cat("d is present:", argPresent("d"), "\n")
cat("e:", argGet("e"), "\n")
cat("e:", argGet("e", choices=c("a", "b", "c")), "\n")

