You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Wolfgang Roessler <co...@roessler-wolfgang.de> on 2007/08/04 23:26:31 UTC

CLI 2

Hello,

I am currently implementing a codegenerator and decided to use CLI for 
command line parsing. As CLI 1.x leaves me with a lot of validation work 
to be done, I decided to give CLI2 a try. It works a lot better for me, 
but I still have some problems. Perhaps there are some ideas to solve them.

The first argument of the command-line should be the target-language to 
generate. As far as I understund, I have two possibilies for this: 
CommandOption and ArgumentOption+EnumValidator. The CommandOption has 
the problem, that I can't define that they are mutually exclusive. With 
the ArgumentOption+EnumValidator the output of the HelpFormatter misses 
the possible values.

When I am using a FileValidator for a argument, e.g. to specify the 
ouput-directory and enforce it is existing, I get an "Unexpected value" 
error if the directory does not exist. I would expect that the argument 
is recognized and a suitable error-message is printed.

Greets
Wolfgang

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: CLI 2

Posted by Lian Ort <li...@googlemail.com>.
Hi Wolfgang,
oh sorry, my mistake. Your question sounded as if you would build your own code
generator from scratch.
OAW does a lot more then velocity. It already has built-in support for
different models.
And this is very interesting:
"The Xtext Framework allows you to define a textual modelling language using
a simple BNF-like notation. The Xtext generator creates a corresponding
parser, an EMF meta-model and an Eclipse text editor with
syntax-highlighting, constraint checking, code completion, an outline view,
etc."
So in the end i think your choice is good :)
Greetings,
Lian

On 8/5/07, Wolfgang Roessler <co...@roessler-wolfgang.de> wrote:
>
> Hi Lian,
>
> I am using openArchitectureware as the codegenerator framework and the
> generated target-languages may be rather exotic (e.g. Structured Text as
> defined in IEC 61131-3).
> But thanks for the hint, I think I should take a look at velocity and
> compare it with OAW.
>
> Greets
> Wolfgang
> > Hi Wolfgang,
> > there are a lot of code generators out there. if you want to save time,
> try
> > for example
> > velocity (http://velocity.apache.org/). It does a fairly good job. It is
> > template based
> > and you can even code your needs in the templates (for example iterate
> over
> > classes in your uml model).
> > Sorry that  this is not an answer to your question...
> > Greetings,
> > Lian
> >
> > On 8/4/07, Wolfgang Roessler <co...@roessler-wolfgang.de> wrote:
> >
> >> Hello,
> >>
> >> I am currently implementing a codegenerator and decided to use CLI for
> >> command line parsing. As CLI 1.x leaves me with a lot of validation
> work
> >> to be done, I decided to give CLI2 a try. It works a lot better for me,
> >> but I still have some problems. Perhaps there are some ideas to solve
> >> them.
> >>
> >> The first argument of the command-line should be the target-language to
> >> generate. As far as I understund, I have two possibilies for this:
> >> CommandOption and ArgumentOption+EnumValidator. The CommandOption has
> >> the problem, that I can't define that they are mutually exclusive. With
> >> the ArgumentOption+EnumValidator the output of the HelpFormatter misses
> >> the possible values.
> >>
> >> When I am using a FileValidator for a argument, e.g. to specify the
> >> ouput-directory and enforce it is existing, I get an "Unexpected value"
> >> error if the directory does not exist. I would expect that the argument
> >> is recognized and a suitable error-message is printed.
> >>
> >> Greets
> >> Wolfgang
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: user-help@commons.apache.org
> >>
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: CLI 2

Posted by Wolfgang Roessler <co...@roessler-wolfgang.de>.
Hi Lian,

I am using openArchitectureware as the codegenerator framework and the 
generated target-languages may be rather exotic (e.g. Structured Text as 
defined in IEC 61131-3).
But thanks for the hint, I think I should take a look at velocity and 
compare it with OAW.

Greets
Wolfgang
> Hi Wolfgang,
> there are a lot of code generators out there. if you want to save time, try
> for example
> velocity (http://velocity.apache.org/). It does a fairly good job. It is
> template based
> and you can even code your needs in the templates (for example iterate over
> classes in your uml model).
> Sorry that  this is not an answer to your question...
> Greetings,
> Lian
>
> On 8/4/07, Wolfgang Roessler <co...@roessler-wolfgang.de> wrote:
>   
>> Hello,
>>
>> I am currently implementing a codegenerator and decided to use CLI for
>> command line parsing. As CLI 1.x leaves me with a lot of validation work
>> to be done, I decided to give CLI2 a try. It works a lot better for me,
>> but I still have some problems. Perhaps there are some ideas to solve
>> them.
>>
>> The first argument of the command-line should be the target-language to
>> generate. As far as I understund, I have two possibilies for this:
>> CommandOption and ArgumentOption+EnumValidator. The CommandOption has
>> the problem, that I can't define that they are mutually exclusive. With
>> the ArgumentOption+EnumValidator the output of the HelpFormatter misses
>> the possible values.
>>
>> When I am using a FileValidator for a argument, e.g. to specify the
>> ouput-directory and enforce it is existing, I get an "Unexpected value"
>> error if the directory does not exist. I would expect that the argument
>> is recognized and a suitable error-message is printed.
>>
>> Greets
>> Wolfgang
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: CLI 2

Posted by Lian Ort <li...@googlemail.com>.
Hi Wolfgang,
there are a lot of code generators out there. if you want to save time, try
for example
velocity (http://velocity.apache.org/). It does a fairly good job. It is
template based
and you can even code your needs in the templates (for example iterate over
classes in your uml model).
Sorry that  this is not an answer to your question...
Greetings,
Lian

On 8/4/07, Wolfgang Roessler <co...@roessler-wolfgang.de> wrote:
>
> Hello,
>
> I am currently implementing a codegenerator and decided to use CLI for
> command line parsing. As CLI 1.x leaves me with a lot of validation work
> to be done, I decided to give CLI2 a try. It works a lot better for me,
> but I still have some problems. Perhaps there are some ideas to solve
> them.
>
> The first argument of the command-line should be the target-language to
> generate. As far as I understund, I have two possibilies for this:
> CommandOption and ArgumentOption+EnumValidator. The CommandOption has
> the problem, that I can't define that they are mutually exclusive. With
> the ArgumentOption+EnumValidator the output of the HelpFormatter misses
> the possible values.
>
> When I am using a FileValidator for a argument, e.g. to specify the
> ouput-directory and enforce it is existing, I get an "Unexpected value"
> error if the directory does not exist. I would expect that the argument
> is recognized and a suitable error-message is printed.
>
> Greets
> Wolfgang
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>