commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christophe Marcourt" <christophe.marco...@mondeca.com>
Subject problem wth CLI
Date Thu, 12 Dec 2002 13:59:31 GMT
This is weird. I create two options (noChecking and noCreation) with a long
option and no short options.
When I use the "-h" option to display the usage message, I only see the
"--no-creation" option. Where is my "--no-checking" option ??? (;-))

I know how to fix this bug. I just have to create these two options with a
short option as well, but I don't want short options for these options...

Below my sample code :

public class Main() {
...

public void createOptions() {
Option noChecking =
OptionBuilder.withLongOpt(Main.NO_CHECKING_OPTION).withDescription("add this
option if you don't want to check \nall the topic ref from the xtm file. The
checking process will be faster.").create();
        Option noCreation =
OptionBuilder.withLongOpt(Main.NO_CREATION_OPTION).withDescription("add this
option if you don't want to create\n all the topics and
classifications.").create();
Option wscr =
OptionBuilder.withArgName("id1,id2,id3,...").hasArgs().withValueSeparator(Ma
in.ID_SEPARATOR).withDescription("required. A comma separated list of
consultation rights
id.").isRequired().create(Main.CONSULTATION_RIGHT_LIST_OPTION);
        wscr.isRequired();
        Option wser =
OptionBuilder.withArgName("id1,id2,id3,...").hasArgs().withValueSeparator(Ma
in.ID_SEPARATOR).withDescription("required. A comma separated list of
edition rights id.").isRequired().create(Main.EDITION_RIGHT_LIST_OPTION);
        wser.isRequired();
        Option wsuser =
OptionBuilder.withArgName("login/password").hasArgs(2).withValueSeparator(Ma
in.LOGIN_PASSWORD_SEPARATOR).withDescription("required. The user's
authentication.").isRequired().create(Main.USER_OPTION);
        wsuser.isRequired();
        Option lang = OptionBuilder.withArgName("language's
id").hasArg().withDescription("the language used to create the new objects.
If ommited, the data items created will be available for all
languages.").create(Main.LANG_OPTION);
        Option help = new Option(Main.HELP_SHORT_OPTION,
Main.HELP_LONG_OPTION, false, "print this message");
        Option logLevel =
OptionBuilder.withArgName("level").hasArg().withDescription("the console log
level. By default fatal.\ndebug : fine-grained informational events that are
most useful to debug an application\ninfo : informational messages that
highlight the progress of the application at coarse-grained level\nwarn :
potentially harmful situations\nerror : error events that might still allow
the application to continue running\nfatal : very severe error events that
will presumably lead the application to abort\noff : turn off the
trace").withLongOpt(Main.LOG_LEVEL_LONG_OPTION).create(Main.LOG_LEVEL_SHORT_
OPTION);

        this.options = new Options();
        this.options.addOption(noChecking);
        this.options.addOption(noCreation);
        this.options.addOption(wscr);
        this.options.addOption(wser);
        this.options.addOption(wsuser);
        this.options.addOption(lang);
        this.options.addOption(help);
        this.options.addOption(logLevel);
}
...
}


Here is my usage message with the "--help" option :

...
options :
    --no-creation          add this option if you don't want to create
                           all the topics and classifications.
 -ll,--log-level <level>   the console log level. By default fatal.
                           debug : fine-grained informational events that
are most useful to debug an
                           application
                           info : informational messages that highlight the
progress of the
                           application at coarse-grained level
                           warn : potentially harmful situations
                           error : error events that might still allow the
application to continue
                           running
                           fatal : very severe error events that will
presumably lead the application
                           to abort
                           off : turn off the trace
 -crl <id1,id2,id3,...>    required. A comma separated list of
                           consultation rights id.
 -erl <id1,id2,id3,...>    required. A comma separated list of edition
                           rights id.
 -h,--help                 print this message
 -lang <language's id>     the language used to create the new objects. If
                           ommited, the data items created will be available
for all languages.
 -user <login/password>    required. The user's authentication.
...

Any idea ??

Christophe Marcourt
Mondeca
Ingenieur R&D
3, Cite Nollez. 75018 Paris
Phone : +33 1 44 92 35 03
Mobile : +33 6 14 48 65 66
Fax : +33 1 44 92 02 59
http://www.mondeca.com/fr
ICQ : #119811844



Mime
View raw message