Alexandru Stanoi a écrit : > ... > > I guess all ways of calling should be supported in order to please > everybody. +1 > So you can write: > > $p->argument( 'arg1' )->argument( 'arg2' )->execute(); > > or: > > $p->arguments( 'arg1', 'arg2' )->execute(); > > Some questions about SystemProcess: > > * Are arguments values abstracted? If I use $p->argument( 'arg1' ) does > it mean the command takes the argument 'arg1' or does it mean it takes > the argument '-arg1' or '--arg1' or '/arg1'? Also some commands require > quotes around arguments if they contain spaces. How about arguments like > '-D sqlite://:memory:' - is this one or two arguments in SystemProcess? > If making it only one argument, we miss all the actual (and only) functionality of using "->argument", namely quoting (I think about 'svn commit file -m "my svn comment"' as an eaxmple). I would resent using ->argument( '-m' )->argument( 'my comment'), as the relation between the two is not clear and -m does not need escaping anyway.
What about: ->arguments( array( 'myfile', '-m' => 'my comment' ) ) > * Is there some abstraction about the arguments' order? Some commands > require the object (file, dir etc) first then the options, while others > require the options first and then the object. Some commands require > '--' between the options and the object. Do you need to know the command > by heart before calling it or can some of the command's details be > abstracted? > The only way I see this working is putting the arguments in the correct order. It is dangerous (and should not be encouraged) to invoke a command without knowing it "by heart" - and impossible to do the translation unless you store the knowledge about every possible system command inside the systemprocess component itself (as eg. the fish shell does). -- Components mailing list [email protected] http://lists.ez.no/mailman/listinfo/components
