-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
featurepackage featurepackage featurein-developmentThis label indicates that the issue is about something intended to be standard within the packageThis label indicates that the issue is about something intended to be standard within the package
Description
This issue is a simple checklist to keep track of the progress of the "argument" class.
The first version is going to be a "rough" but "complete" sketch that can handle the standard input types, in a similar but not identical manner to the python argparse
module.
For this the argument needs to
- Accept cmdline flags (at least 1 and 2, but possibly more)
- Be knowing of their own name
- Have knowledge of how to be restrictive to a certain range of argument count (
narg
) - Be able to handle how to be a
required
argument, and its interaction ontonarg
- Be able to be a flag, and have methods for handling being the best flag that it can be
- Be able to carry a default value, and know how this should be handled (specifically its interaction with
required
andnarg
) - Should have knowledge of different possible
actions
and their effect on other parameters (such asstore_const
,append_const
,store
and so forth) - Note that with R's data structures some changes makes sense here
- Be able to handle
const
values (with specific actions) - Be able to restrict itself to only a set of choices
- It should be able to contain a
parser.func
(an R function) which can be used to parse the arguments - It should obviously be able to parse its own arguments, eg. have knowledge of how to call
parser.func
and this - later on we'll look at handling help messages, meta variables, etc. But for this I think I'll split the class into different children (the plan has not been sketched yet).
- again later I should implement some standard methods for "integer", "double" and "string" (the latter returns "as is") to avoid the repeated call to the R api (as much as possible).
- Shortly after implementation is done it should be able to handle a call to R's
as
function, and be able to test if a string is a valid function. The method should be- Test if
parser_func
is a function, if so use it - Test if
parser_func
is a string, if not throw error - Test that
parser_func
string is within builtin methods (once implemented) if so, use it - Test that
parser_func
string is an actual function usingget_function
(usingRf_findFun
fromR.h
, see Rcpp::Function) - If everything else fails create a call to the R function
as
, using theS4
method forcoerce
.
- Test if
This should ensure somewhat optimal speeds.
The argument should not necessarily need to know whether it is a "positional" argument, as this is handled by the parser itself. Help message formatting, meta data and so on should come in once everything else is setup, classes are split into sub methods and so on.
Note that the argument of argparse
type is redefined as parser.func
(or parser_func
in Cpp), as this is a more apt naming for the input.
Metadata
Metadata
Assignees
Labels
featurepackage featurepackage featurein-developmentThis label indicates that the issue is about something intended to be standard within the packageThis label indicates that the issue is about something intended to be standard within the package