You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking to 'build or buy' a replacement for the option handling for xmlsh
In xmlsh command arguments do not generally come from an external java (or process) launch,
but from the interpreter itself. The 'command line' args are a list of java objects, none of them java.lang.String, rather an internal type (XValue) which can hold a String, or any other Java object (internally typically JSON or XML nodes, lists, arrays, methods, -- but can be pure java.lang.Object).
However the same basic functionality is needed -- including the desire to be able to use annotations to declare options as well as generate the help docs, and ideally enough metadata to do type conversions, overload resolutions etc.
Args4J looks very close to what I need -- including the ability to have values be any object.
But -- as most (all?) option parser libraries I've seen assume the initial input is a String[] ..
Given a List I can detect which values are atomic and 'string equivalents' enough to call toString() on them -- that lets me seperate out the possible options from the option values in the parser.
( I wouldnt want to say call toString() on a 1GB XML node or a remote process Future<> just to determine if it starts with "-" -- but I do have a method like 'value.isAtomicString()' which is efficient).
I am wondering if you had a rough feeling of how much of the codebase would be impacted by allowing non String values as arguements ? Possibly all implementing a simple interface like
interface IArg {
// effectively 'Is this arg a candidate to treat as a flag/option like '--arg'
boolean isSimpleString();
String toString(); // dont call unless isSimpleString() == true
Object value() ; // may be unneeded by the parser itself --
};
Then say have an overload of CmdLineParser line one of these
I'm looking to 'build or buy' a replacement for the option handling for xmlsh
In xmlsh command arguments do not generally come from an external java (or process) launch,
but from the interpreter itself. The 'command line' args are a list of java objects, none of them java.lang.String, rather an internal type (XValue) which can hold a String, or any other Java object (internally typically JSON or XML nodes, lists, arrays, methods, -- but can be pure java.lang.Object).
However the same basic functionality is needed -- including the desire to be able to use annotations to declare options as well as generate the help docs, and ideally enough metadata to do type conversions, overload resolutions etc.
Args4J looks very close to what I need -- including the ability to have values be any object.
But -- as most (all?) option parser libraries I've seen assume the initial input is a String[] ..
Given a List I can detect which values are atomic and 'string equivalents' enough to call toString() on them -- that lets me seperate out the possible options from the option values in the parser.
( I wouldnt want to say call toString() on a 1GB XML node or a remote process Future<> just to determine if it starts with "-" -- but I do have a method like 'value.isAtomicString()' which is efficient).
I am wondering if you had a rough feeling of how much of the codebase would be impacted by allowing non String values as arguements ? Possibly all implementing a simple interface like
Then say have an overload of CmdLineParser line one of these
Just looking for a rough idea of if this is feasible short of a total rewrite.
Thanks
The text was updated successfully, but these errors were encountered: