getargs

parse positional parameters

SYNOPSIS

getargs [ -C callback ] [ -V ] -- arguments...

DESCRIPTION

parse the positional parameters according to values specified in array named as getargs. Also return the values in GETARGS array.

getargs

getargs must be a pseudo 4-dimensional array with the following columns for each row (in that order):

  • short
  • long
  • argument
  • repeat

short is the first column which defines a short option.A short option must be single character long, since only single characters are used to match short options Thus making a short option either NULL or more than one character ensures that it would not match any short option, effectively stating that there is no short option for this case.

long defines a long option, it can be any length, if NULL means there is no long option.

if argument is :, it means that the option requires an argument, anything else means it doesnot require an argument.

repeat represents how many times the argument can be repeated, if 0 means that option should not be present at all.If negative number then, it means it can be repeated infinite number of times.

GETARGS

This is a non-sparse array which contains argument to an option or null.

GETARGS_

This is an associative array which contains the option found as index and space followed by index of each occurance of argument as element, so that each argument for multiple occurences may be found and also so that number of spaces in element corresponds to number of occurences of the given option.

OPTIONS

-c callback call the callback for each option found.
-V do not set variables

Return Status