Skip Menu |

This queue is for tickets about the App-Options CPAN distribution.

Report information
The Basics
Id: 60744
Status: open
Priority: 0/
Queue: App-Options

People
Owner: Nobody in particular
Requestors: sharyanto [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Treat some command-line argument as option
I have a homebrewn command line processing module with this feature (which I plan to incorporate Config::Tree::CmdLine): interpret some command line argument as options. Example syntax in App::Options: use App::Options ( option => { src => { ..., required=>1, cmdline_arg_order => 0 }, dest => { ..., required=>1, cmdline_arg_order => 1 }, foo => { ..., required=>0, } ... } ); This way, beside the usual: script.pl --src=SRC --dest=DEST [--foo=...] I can also write: script.pl SRC DEST [--foo=...] which is shorter. This is nice since I tend to not use @ARGV and have everything as options (because of "free" validation and documentation in the option specification). You might want to consider adding something like this. Regards, Steven
Subject: Re: [rt.cpan.org #60744] Treat some command-line argument as option
Date: Wed, 25 Aug 2010 23:07:06 -0400
To: bug-App-Options [...] rt.cpan.org
From: Stephen Adkins <spadkins [...] gmail.com>
Hi, That is a reasonable suggestion, but I would only allow the positional params to occur AFTER all options. That is the Unix way of doing command line options. Would that remove its usefulness to you? Stephen On Wed, Aug 25, 2010 at 9:13 PM, steven haryanto via RT < bug-App-Options@rt.cpan.org> wrote: Show quoted text
> Wed Aug 25 21:13:35 2010: Request 60744 was acted upon. > Transaction: Ticket created by SHARYANTO > Queue: App-Options > Subject: Treat some command-line argument as option > Broken in: (no value) > Severity: Wishlist > Owner: Nobody > Requestors: sharyanto@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60744 > > > > I have a homebrewn command line processing module with this feature > (which I plan to incorporate Config::Tree::CmdLine): interpret some > command line argument as options. Example syntax in App::Options: > > use App::Options ( > option => { > src => { ..., required=>1, cmdline_arg_order => 0 }, > dest => { ..., required=>1, cmdline_arg_order => 1 }, > foo => { ..., required=>0, } > ... > } > ); > > This way, beside the usual: > > script.pl --src=SRC --dest=DEST [--foo=...] > > I can also write: > > script.pl SRC DEST [--foo=...] > > which is shorter. This is nice since I tend to not use @ARGV and have > everything as options (because of "free" validation and documentation > in the option specification). > > You might want to consider adding something like this. > > Regards, > Steven > >
Not really, I tend to specify options before all positional params anyway, but btw in my module I enable/disable this behaviour (per some flag). Steven On Wed Aug 25 23:07:14 2010, SPADKINS wrote: Show quoted text
> Hi, > > That is a reasonable suggestion, but I would only allow the positional > params to occur AFTER all options. That is the Unix way of doing
command Show quoted text
> line options. > > Would that remove its usefulness to you? > > Stephen > > On Wed, Aug 25, 2010 at 9:13 PM, steven haryanto via RT < > bug-App-Options@rt.cpan.org> wrote: >
> > Wed Aug 25 21:13:35 2010: Request 60744 was acted upon. > > Transaction: Ticket created by SHARYANTO > > Queue: App-Options > > Subject: Treat some command-line argument as option > > Broken in: (no value) > > Severity: Wishlist > > Owner: Nobody > > Requestors: sharyanto@cpan.org > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60744 > > > > > > > I have a homebrewn command line processing module with this feature > > (which I plan to incorporate Config::Tree::CmdLine): interpret some > > command line argument as options. Example syntax in App::Options: > > > > use App::Options ( > > option => { > > src => { ..., required=>1, cmdline_arg_order => 0 }, > > dest => { ..., required=>1, cmdline_arg_order => 1 }, > > foo => { ..., required=>0, } > > ... > > } > > ); > > > > This way, beside the usual: > > > > script.pl --src=SRC --dest=DEST [--foo=...] > > > > I can also write: > > > > script.pl SRC DEST [--foo=...] > > > > which is shorter. This is nice since I tend to not use @ARGV and
have Show quoted text
> > everything as options (because of "free" validation and
documentation Show quoted text
> > in the option specification). > > > > You might want to consider adding something like this. > > > > Regards, > > Steven > > > >