Quantcast

Preparing the CLI RFC

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Preparing the CLI RFC

robertbasic
Hi all!

I'm working on the RFC for the CLI components.

What I have so far can be found here:
http://framework.zend.com/wiki/display/ZFDEV2/RFC+-+CLI

I feel I'm getting close to finishing it and finally submitting it for
debate, but as this is might first RFC ever, I'd like feedback on did I
cover enough/everything/too little/too much? Is it understandable enough?
What big parts am I missing here?

I'd like to finish this thing today, so fire away.

--
~Robert Basic;
http://robertbasic.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Preparing the CLI RFC

Tomáš Fejfar
I'd suggest a little feature, that will be usefull - colorized output. It's
PITA to write that yourself and it's great for CLI scripts. Question is how
to implement it easily ;)

On Tue, Nov 1, 2011 at 1:26 PM, Robert Basic <[hidden email]>wrote:

> Hi all!
>
> I'm working on the RFC for the CLI components.
>
> What I have so far can be found here:
> http://framework.zend.com/wiki/display/ZFDEV2/RFC+-+CLI
>
> I feel I'm getting close to finishing it and finally submitting it for
> debate, but as this is might first RFC ever, I'd like feedback on did I
> cover enough/everything/too little/too much? Is it understandable enough?
> What big parts am I missing here?
>
> I'd like to finish this thing today, so fire away.
>
> --
> ~Robert Basic;
> http://robertbasic.com/
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Preparing the CLI RFC

robertbasic
2011/11/1 Tomáš Fejfar <[hidden email]>

> I'd suggest a little feature, that will be usefull - colorized output.
> It's PITA to write that yourself and it's great for CLI scripts. Question
> is how to implement it easily ;)
>
>
It is planned to have that, these would be the output content decorators
under Zend\Console.

Thanks!

--
~Robert Basic;
http://robertbasic.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Preparing the CLI RFC

DeNix
In reply to this post by robertbasic
few things

- do I get it right that Zend\Cli will have no flexibility in
parsing/routing cli options/argument?
and no way to rote certain options to module/controller/action ?
I mean,  let's say tar style
 >tar -c -z -f archive.tar.gz file1 file2
should be something like
 > tar create file --compression=gzip archive.tar.gz file1 file2
to be routed properly

- not sure about --help hardcoded into Zend\Cli
I think it's up to developer how to provide help messages to end user
(if at all)
it could be option, orspecial command > script.php help [command] [argument]

afterall there is no error controler hardcoded into Zend\Mvc component

Thanks
Denis

On 01.11.2011 16:26, Robert Basic wrote:

> Hi all!
>
> I'm working on the RFC for the CLI components.
>
> What I have so far can be found here:
> http://framework.zend.com/wiki/display/ZFDEV2/RFC+-+CLI
>
> I feel I'm getting close to finishing it and finally submitting it for
> debate, but as this is might first RFC ever, I'd like feedback on did I
> cover enough/everything/too little/too much? Is it understandable enough?
> What big parts am I missing here?
>
> I'd like to finish this thing today, so fire away.
>


--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Preparing the CLI RFC

weierophinney
Administrator
-- Denis Portnov <[hidden email]> wrote
(on Tuesday, 01 November 2011, 07:25 PM +0400):

> few things
>
> - do I get it right that Zend\Cli will have no flexibility in
>   parsing/routing cli options/argument?
>   and no way to rote certain options to module/controller/action ?
>   I mean,  let's say tar style
>     $ tar -c -z -f archive.tar.gz file1 file2
>   should be something like
>     $ tar create file --compression=gzip archive.tar.gz file1 file2
>   to be routed properly

My understanding is that this _will_ be flexible, and use a combination
of argument position and named options to identify what should happen.

> - not sure about --help hardcoded into Zend\Cli
>   I think it's up to developer how to provide help messages to end
>   user (if at all)
>   it could be option, orspecial command > script.php help [command] [argument]
>
> afterall there is no error controler hardcoded into Zend\Mvc component

Actually, Zend_Console_Getopt has been doing this all along, and it's an
expected feature of any CLI command. The one thing it doesn't allow you
to do is provide preamble/postfix text, and that is planned for the CLI
and/or Getopt implementation. Reporting of the available options,
however, _should_ be handled directly by the tool.


> On 01.11.2011 16:26, Robert Basic wrote:
> >I'm working on the RFC for the CLI components.
> >
> >What I have so far can be found here:
> >http://framework.zend.com/wiki/display/ZFDEV2/RFC+-+CLI
> >
> >I feel I'm getting close to finishing it and finally submitting it for
> >debate, but as this is might first RFC ever, I'd like feedback on did I
> >cover enough/everything/too little/too much? Is it understandable enough?
> >What big parts am I missing here?
> >
> >I'd like to finish this thing today, so fire away.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Preparing the CLI RFC

robertbasic
On Tue, Nov 1, 2011 at 4:39 PM, Matthew Weier O'Phinney <[hidden email]>wrote:

> -- Denis Portnov <[hidden email]> wrote
> (on Tuesday, 01 November 2011, 07:25 PM +0400):
> > few things
> >
> > - do I get it right that Zend\Cli will have no flexibility in
> >   parsing/routing cli options/argument?
> >   and no way to rote certain options to module/controller/action ?
> >   I mean,  let's say tar style
> >     $ tar -c -z -f archive.tar.gz file1 file2
> >   should be something like
> >     $ tar create file --compression=gzip archive.tar.gz file1 file2
> >   to be routed properly
>
> My understanding is that this _will_ be flexible, and use a combination
> of argument position and named options to identify what should happen.
>
>
Exactly - you define the route, Getopt (or whatever it's name will be after
refactoring) will parse the arguments and the router will put in the
Parameters container - named ones with the names, position ones with index
numbers.


> > - not sure about --help hardcoded into Zend\Cli
> >   I think it's up to developer how to provide help messages to end
> >   user (if at all)
> >   it could be option, orspecial command > script.php help [command]
> [argument]
> >
> > afterall there is no error controler hardcoded into Zend\Mvc component
>
> Actually, Zend_Console_Getopt has been doing this all along, and it's an
> expected feature of any CLI command. The one thing it doesn't allow you
> to do is provide preamble/postfix text, and that is planned for the CLI
> and/or Getopt implementation. Reporting of the available options,
> however, _should_ be handled directly by the tool.
>
>
But after refactoring Getopt will allow to define preamble/postfix text,
with the added option of Zend\Cli\Something (ApplicationHelp?) to parse the
docblocks and add that as a help message. Or something like that :)


>
> > On 01.11.2011 16:26, Robert Basic wrote:
> > >I'm working on the RFC for the CLI components.
> > >
> > >What I have so far can be found here:
> > >http://framework.zend.com/wiki/display/ZFDEV2/RFC+-+CLI
> > >
> > >I feel I'm getting close to finishing it and finally submitting it for
> > >debate, but as this is might first RFC ever, I'd like feedback on did I
> > >cover enough/everything/too little/too much? Is it understandable
> enough?
> > >What big parts am I missing here?
> > >
> > >I'd like to finish this thing today, so fire away.
>
> --
> Matthew Weier O'Phinney
> Project Lead            | [hidden email]
> Zend Framework          | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>
> --
> List: [hidden email]
> Info: http://framework.zend.com/archives
> Unsubscribe: [hidden email]
>
>
>


--
~Robert Basic;
http://robertbasic.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Preparing the CLI RFC

DeNix
In reply to this post by weierophinney
On 01.11.2011 19:39, Matthew Weier O'Phinney wrote:

>> - not sure about --help hardcoded into Zend\Cli
>>    I think it's up to developer how to provide help messages to end
>>    user (if at all)
>>    it could be option, orspecial command>  script.php help [command] [argument]
>>
>> afterall there is no error controler hardcoded into Zend\Mvc component
> Actually, Zend_Console_Getopt has been doing this all along, and it's an
> expected feature of any CLI command. The one thing it doesn't allow you
> to do is provide preamble/postfix text, and that is planned for the CLI
> and/or Getopt implementation. Reporting of the available options,
> however, _should_ be handled directly by the tool.
>
ok, no objection that cli application should provide usage messages
the question is , how it should be done

in my opinion it should be flexible
if we are talking about cli mvc application, some option (RFC:
 >script.php --help) or command (>script.php help)
should route controler defined by developer that provides usage message
or, if no such controller provided, should print out some basic usage
message






--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Preparing the CLI RFC

robertbasic
2011/11/1 Denis Portnov <[hidden email]>

> ok, no objection that cli application should provide usage messages
> the question is , how it should be done
>
> in my opinion it should be flexible
> if we are talking about cli mvc application, some option (RFC: >script.php
> --help) or command (>script.php help)
> should route controler defined by developer that provides usage message
> or, if no such controller provided, should print out some basic usage
> message
>
>
So far nothing has been written in stone. Evan Coury said he'd like a help
system a la git (e.g.: git commit --help), and that's where the idea came
from. But then again, he also said he'd like a man page like system, too. :)

--
~Robert Basic;
http://robertbasic.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Preparing the CLI RFC

DeNix
In reply to this post by robertbasic
On 01.11.2011 19:48, Robert Basic wrote:

> - do I get it right that Zend\Cli will have no flexibility in
>    parsing/routing cli options/argument?
>    and no way to rote certain options to module/controller/action ?
>    I mean,  let's say tar style
>      $ tar -c -z -f archive.tar.gz file1 file2
>    should be something like
>      $ tar create file --compression=gzip archive.tar.gz file1 file2
>    to be routed properly
>> My understanding is that this _will_ be flexible, and use a combination
>> of argument position and named options to identify what should happen.
>>
>>
> Exactly - you define the route, Getopt (or whatever it's name will be after
> refactoring) will parse the arguments and the router will put in the
> Parameters container - named ones with the names, position ones with index
> numbers.
>
understood
the question here is how complex cli router should be
will something like this be possible:

 > script.php create user                              // routed to
createUserAction()
 > script.php create user --type=admin    // routed to createAdminAction()

if yes, this requires pretty sophisticated route configuration

Thanks
Denis

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Preparing the CLI RFC

robertbasic
2011/11/1 Denis Portnov <[hidden email]>

> On 01.11.2011 19:48, Robert Basic wrote:
>
>> - do I get it right that Zend\Cli will have no flexibility in
>>   parsing/routing cli options/argument?
>>   and no way to rote certain options to module/controller/action ?
>>   I mean,  let's say tar style
>>     $ tar -c -z -f archive.tar.gz file1 file2
>>   should be something like
>>     $ tar create file --compression=gzip archive.tar.gz file1 file2
>>   to be routed properly
>>
>>> My understanding is that this _will_ be flexible, and use a combination
>>> of argument position and named options to identify what should happen.
>>>
>>>
>>>  Exactly - you define the route, Getopt (or whatever it's name will be
>> after
>> refactoring) will parse the arguments and the router will put in the
>> Parameters container - named ones with the names, position ones with index
>> numbers.
>>
>>  understood
> the question here is how complex cli router should be
> will something like this be possible:
>
> > script.php create user                              // routed to
> createUserAction()
> > script.php create user --type=admin    // routed to createAdminAction()
>
> if yes, this requires pretty sophisticated route configuration
>
>
No, "--type=admin" in this case would be a named argument (option? I always
mix what is what). I'm thinking in the way of the Literal route we have
now, or the Static route in ZF1.

But, something like this would probably be possible:

>script.php create user [hidden email] // createUserAction, and you set a
named parameter to email
>script.php create admin [hidden email] //createAdminAction, and you set a
named parameter to email

This is something like Zend_Controller_Router_Route in ZF 1.

Again, nothing is decided on this, except that we should keep it as simple
as possible and needed.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Preparing the CLI RFC

mattcockayne
Think we need to add something to the RFC covering handling the current
"environment". Check out my Environment object prototype for what im trying
to get at.

Other than that its looking great
Loading...