You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Christophe Marcourt <ch...@mondeca.com> on 2002/12/12 14:59:31 UTC

problem wth CLI

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



RE: problem wth CLI

Posted by Christophe Marcourt <ch...@mondeca.com>.
Yes I use the 1.0 version and I don't get yet the CVS source...
I will update the sources of CLI, so.

Thank you

Christophe Marcourt
Mondeca
Ingénieur R&D
3, Cité 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

-----Message d'origine-----
De : John Keyes [mailto:jbjk@mac.com]
Envoyé : jeudi 12 décembre 2002 15:05
À : Jakarta Commons Users List
Objet : Re: problem wth CLI

Hi Christophe,

Are you using the 1.0 version?  A fix for this bug was
committed a few weeks ago to CVS.  I'll test this when
I get a chance.

-John K

On Thu, 2002-12-12 at 13:59, Christophe Marcourt wrote:
> 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
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
John Keyes <jb...@mac.com>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


Re: problem wth CLI

Posted by John Keyes <jb...@mac.com>.
Hi Christophe,

Are you using the 1.0 version?  A fix for this bug was
committed a few weeks ago to CVS.  I'll test this when
I get a chance.

-John K

On Thu, 2002-12-12 at 13:59, Christophe Marcourt wrote:
> 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
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
-- 
John Keyes <jb...@mac.com>