Feature request: write_into_file prints *_arg, too

View: New views
4 Messages — Rating Filter:   Alert me  

Feature request: write_into_file prints *_arg, too

by Papp Gyozo (VBuster) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I think it vould be very handsome for diagnosting purposes, if not only can the options' _orig field be printed/dumped by the parser but their translated/interpreted _arg fields as well, probably as a comment:

  option = "ele" # element

The point here is that application may alter the user-supplied arguments, thus when dumping the actual config it may worth knowing what the application really thinks abou the options' actual value.

What do you think about it? I'll probably come up with a patch if I find how to do it ;)

--
Papp, Gyozo
Virusbuster Kft


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: Feature request: write_into_file prints *_arg, too

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Papp Gyozo (VBuster) wrote:

> Hi,
>
> I think it vould be very handsome for diagnosting purposes, if not
> only can the options' _orig field be printed/dumped by the parser but
> their translated/interpreted _arg fields as well, probably as a
> comment:
>
> option = "ele" # element
>
> The point here is that application may alter the user-supplied
> arguments, thus when dumping the actual config it may worth knowing
> what the application really thinks abou the options' actual value.
>

Hi there!

yes that'd be helpful; of course, this makes sense only for options with
values right?

> What do you think about it? I'll probably come up with a patch if I
> find how to do it ;)

well it should be "quite" simple:

- first of all, I assume this will be done only for options with values
- in this case, output the element of the array holding the string
values for an option with values (using the correct index)

what do you think?

Notice that I'd avoid print numeric values since their conversion into
strings highly depends on how you format them (I'm talking about numbers
with decimals, e.g.)

Or were you taking about different scenarios?

cheers
        Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net



_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: Feature request: write_into_file prints *_arg, too

by Papp Gyozo (VBuster) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> > I think it vould be very handsome for diagnosting purposes, if not
> > only can the options' _orig field be printed/dumped by the parser but
> > their translated/interpreted _arg fields as well, probably as a
> > comment:
> >
> > option = "ele" # element
> >
> > The point here is that application may alter the user-supplied
> > arguments, thus when dumping the actual config it may worth knowing
> > what the application really thinks abou the options' actual value.
> >
>
> yes that'd be helpful; of course, this makes sense only for options with
> values right?

As far as I see, yes. (Actually I'd like to use only for enums ;) and strings.)

> well it should be "quite" simple:
>
> - first of all, I assume this will be done only for options with values
> - in this case, output the element of the array holding the string
> values for an option with values (using the correct index)

well, actually I

I took a look at generated source and I figured out I would have to modify write_into_file() function.  I don't see how it would be the best though...

> Notice that I'd avoid print numeric values since their conversion into

Oh, I thought _orig always contains the original string representation from argv[]. By the way, it doesn't matter me right now as I said before I want to use it for string option in first place.


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: Feature request: write_into_file prints *_arg, too

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

this version

http://rap.dsi.unifi.it/~bettini/gengetopt-2.22b.tar.gz

should implement also this feature: it saves (in a comment) also the
corresponding actual value for options with values (and enums)

I'd be ready with 2.22 release by next week

hope to hear from you soon
        Lorenzo

Papp Gyozo (VBuster) wrote:

>>> I think it vould be very handsome for diagnosting purposes, if not
>>> only can the options' _orig field be printed/dumped by the parser but
>>> their translated/interpreted _arg fields as well, probably as a
>>> comment:
>>>
>>> option = "ele" # element
>>>
>>> The point here is that application may alter the user-supplied
>>> arguments, thus when dumping the actual config it may worth knowing
>>> what the application really thinks abou the options' actual value.
>>>
>> yes that'd be helpful; of course, this makes sense only for options with
>> values right?
>
> As far as I see, yes. (Actually I'd like to use only for enums ;) and strings.)
>
>> well it should be "quite" simple:
>>
>> - first of all, I assume this will be done only for options with values
>> - in this case, output the element of the array holding the string
>> values for an option with values (using the correct index)
>
> well, actually I
>
> I took a look at generated source and I figured out I would have to modify write_into_file() function.  I don't see how it would be the best though...
>
>> Notice that I'd avoid print numeric values since their conversion into
>
> Oh, I thought _orig always contains the original string representation from argv[]. By the way, it doesn't matter me right now as I said before I want to use it for string option in first place.
>
>
> _______________________________________________
> Help-gengetopt mailing list
> Help-gengetopt@...
> http://lists.gnu.org/mailman/listinfo/help-gengetopt
>


--
Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt