X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2Fargparser%2FArg.java;h=91cfe4d8b882f21f91d6139770e0f3c40c26c339;hb=91581a29a66a51e9c2f3039fd2df8c8870acd606;hp=f71201073a240f58726f37195464d3cdb453eed6;hpb=0788111a588187a04dd0d254d70b055274cf2c9d;p=jalview.git diff --git a/src/jalview/bin/argparser/Arg.java b/src/jalview/bin/argparser/Arg.java index f712010..91cfe4d 100644 --- a/src/jalview/bin/argparser/Arg.java +++ b/src/jalview/bin/argparser/Arg.java @@ -11,16 +11,49 @@ public enum Arg { HELP("h"), CALCULATION, MENUBAR, STATUS, SHOWOVERVIEW, ANNOTATIONS, COLOUR, FEATURES, GROOVY, GROUPS, HEADLESS, JABAWS, DISPLAY, GUI, NEWS, - SORTBYTREE, USAGESTATS, OPEN, OPENNEW, PROPS, QUESTIONNAIRE, SETPROP, - TREE, VDOC, VSESS, OUTPUT, OUTPUTTYPE, SSANNOTATIONS, NOTEMPFAC, TEMPFAC, - TITLE, PAEMATRIX, WRAP, NOSTRUCTURE, STRUCTURE, STRUCTUREVIEWER, IMAGE, - QUIT, CLOSE, DEBUG("d"), QUIET("q"), ARGFILE, INCREMENT, NPP("n++"), - SUBSTITUTIONS, INITSUBSTITUTIONS, NIL, SPLASH, SETARGFILE, UNSETARGFILE; + SORTBYTREE, USAGESTATS, APPEND, OPEN, PROPS, QUESTIONNAIRE, SETPROP, TREE, + VDOC, VSESS, OUTPUT, SSANNOTATIONS, NOTEMPFAC, TEMPFAC, TITLE, PAEMATRIX, + WRAP, NOSTRUCTURE, STRUCTURE, STRUCTUREVIEWER, IMAGE, QUIT, CLOSE, + DEBUG("d"), QUIET("q"), ARGFILE, NEWFRAME, NPP("n++"), SUBSTITUTIONS, + INITSUBSTITUTIONS, NIL, SPLASH, SETARGFILE, UNSETARGFILE, + WEBSERVICEDISCOVERY, ALLFRAMES; protected static enum Opt { - BOOLEAN, STRING, UNARY, MULTI, LINKED, NODUPLICATEVALUES, BOOTSTRAP, - GLOB, NOACTION, ALLOWSUBSTITUTIONS, PRIVATE + BOOLEAN, // This Arg can be specified as --arg or --noarg to give true or + // false. A default can be given with setOptions(bool, Opt....). + // Use ArgParser.isSet(Arg) to see if this arg was not specified. + STRING, // This Arg can accept a value either through --arg=value or --arg + // value. + UNARY, // This Arg is a boolean value, true if present, false if not. Like + // BOOLEAN but without the --noarg option. + MULTI, // This Arg can be specified multiple times. Multiple values are + // stored in the ArgValuesMap (along with their positional index) for + // each linkedId. + LINKED, // This Arg can be linked to others through a --arg[linkedId] or + // --arg[linkedId]=value. If no linkedId is specified then the + // current default linkedId will be used. + NODUPLICATEVALUES, // This Arg can only have one value (per linkedId). The + // first value will be used and subsequent values ignored + // with a warning. + BOOTSTRAP, // This Arg value(s) can be determined at an earlier stage than + // non-BOOTSTRAP Args. Substitutions do not happen in BOOTSTRAP + // Args and they cannot be linked or contain SubVals. See + // jalview.bin.argparser.BootstrapArgs. + GLOB, // This Arg can expand wildcard filename "globs" (e.g. + // path/*/filename*). If the Arg value is given as --arg filename* + // then the shell will have expanded the glob already, but if + // specified as --arg=filename* then the Java glob expansion method + // will be used (see FileUtils.getFilenamesFromGlob()). Note that this + // might be different from the shell expansion rules. + NOACTION, // This Arg does not perform a data task, usually used to control + // flow in ArgParser.parse(args). + ALLOWSUBSTITUTIONS, // This Arg allows substitutions in its linkedId, + // SubVals and values. + PRIVATE, // This Arg is used internally, and cannot be specified by the + // user. + ALLOWALL, // This Arg can use the '*' linkedId to apply to all known + // linkedIds } static @@ -47,9 +80,9 @@ public enum Arg // expects a string value SORTBYTREE.setOptions(true, Opt.BOOLEAN); USAGESTATS.setOptions(true, Opt.BOOLEAN); - OPEN.setOptions(Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.GLOB, + APPEND.setOptions(Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.GLOB, Opt.ALLOWSUBSTITUTIONS); - OPENNEW.setOptions(Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.GLOB, + OPEN.setOptions(Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.GLOB, Opt.ALLOWSUBSTITUTIONS); PROPS.setOptions(Opt.STRING, Opt.BOOTSTRAP); QUESTIONNAIRE.setOptions(Opt.BOOLEAN, Opt.BOOTSTRAP); @@ -59,8 +92,8 @@ public enum Arg VDOC.setOptions(Opt.UNARY); VSESS.setOptions(Opt.UNARY); - OUTPUT.setOptions(Opt.STRING, Opt.LINKED, Opt.ALLOWSUBSTITUTIONS); - OUTPUTTYPE.setOptions(Opt.STRING, Opt.LINKED, Opt.MULTI); + OUTPUT.setOptions(Opt.STRING, Opt.LINKED, Opt.ALLOWSUBSTITUTIONS, + Opt.ALLOWALL); SSANNOTATIONS.setOptions(Opt.BOOLEAN, Opt.LINKED); NOTEMPFAC.setOptions(Opt.UNARY, Opt.LINKED); @@ -73,25 +106,23 @@ public enum Arg Opt.ALLOWSUBSTITUTIONS); STRUCTUREVIEWER.setOptions(Opt.STRING, Opt.LINKED, Opt.MULTI); WRAP.setOptions(Opt.BOOLEAN, Opt.LINKED); - IMAGE.setOptions(Opt.STRING, Opt.LINKED, Opt.ALLOWSUBSTITUTIONS); + IMAGE.setOptions(Opt.STRING, Opt.LINKED, Opt.ALLOWSUBSTITUTIONS, + Opt.ALLOWALL); QUIT.setOptions(Opt.UNARY); - CLOSE.setOptions(Opt.UNARY, Opt.LINKED); + CLOSE.setOptions(Opt.UNARY, Opt.LINKED, Opt.ALLOWALL); DEBUG.setOptions(Opt.BOOLEAN, Opt.BOOTSTRAP); QUIET.setOptions(Opt.UNARY, Opt.MULTI, Opt.BOOTSTRAP); ARGFILE.setOptions(Opt.STRING, Opt.MULTI, Opt.BOOTSTRAP, Opt.GLOB, Opt.ALLOWSUBSTITUTIONS); - INCREMENT.setOptions(Opt.UNARY, Opt.MULTI, Opt.NOACTION); + NEWFRAME.setOptions(Opt.UNARY, Opt.MULTI, Opt.NOACTION); NPP.setOptions(Opt.UNARY, Opt.MULTI, Opt.NOACTION); SUBSTITUTIONS.setOptions(Opt.BOOLEAN, Opt.MULTI, Opt.NOACTION); INITSUBSTITUTIONS.setOptions(Opt.BOOLEAN, Opt.BOOTSTRAP, Opt.NOACTION); NIL.setOptions(Opt.UNARY, Opt.LINKED, Opt.MULTI, Opt.NOACTION); SETARGFILE.setOptions(Opt.STRING, Opt.MULTI, Opt.PRIVATE, Opt.NOACTION); UNSETARGFILE.setOptions(Opt.MULTI, Opt.PRIVATE, Opt.NOACTION); - // Opt.BOOTSTRAP args are parsed (not linked with no SubVals so using a - // simplified parser, see jalview.bin.argparser.BootstrapArgs) - // before a full parse of arguments and so can be accessible at an earlier - // stage to (e.g.) set debug log level, provide a props file (that might set - // log level), run headlessly, read an argfile instead of other args. + WEBSERVICEDISCOVERY.setOptions(Opt.BOOLEAN, Opt.BOOTSTRAP); + ALLFRAMES.setOptions(Opt.BOOLEAN, Opt.MULTI, Opt.NOACTION); } private final String[] argNames;