Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.2

Request #18008 support "list" arguments like list options
Submitted: 2010-10-29 13:58 UTC
From: cweiske Assigned: farell
Status: Closed Package: Console_CommandLine (version 1.1.3)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2010-10-29 13:58 UTC] cweiske (Christian Weiske)
Description: ------------ It would be cool if Console_CommandLine would support the "list" parameter for arguments - the way it does for options. Example: My tool is used to copy files to one of a list of supported remote systems. $ php copy.php $targetsystem file1 file2 ... Now $targetsystem is no option but a mandatory argument, and only a list of allowed options is possible.

Comments

 [2010-10-29 15:08 UTC] rquadling (Richard Quadling)
The obvious answer is to use --target $targetsystem and --target is a list controlled option.
 [2010-10-29 15:12 UTC] cweiske (Christian Weiske)
Using an option is not an option since options are optional :)
 [2010-10-29 15:22 UTC] izi (David Jean Louis)
I agree with Christian here, and this is clearly explained in the Console_CommandLine manual: "Lots of people want their programs to have "required options". Think about it. If it's required, then it's not optional! If there is a piece of information that your program absolutely requires in order to run successfully, that's what arguments are for." I'll be super busy for the next monthes... Christian or Richard, feel free to work on this ! -- David
 [2010-10-29 15:50 UTC] rquadling (Richard Quadling)
My opinion on this is that all the command line options and arguments should have all the same features. I draw your attention to http://pear.php.net/bugs/bug.php?id=16679, though I couldn't argue my case well enough it seems. I think I should be able to have an 'action' for an argument (filename or directory validation for example: exists, !exists). Christian would like a 'list' for an argument.
 [2012-09-28 13:52 UTC] farell (Laurent Laville)
Hello all, I've recently found this kind of feature required in my PHP_CompatInfo (CLI) https://github.com/llaville/php-compat-info So rather than patche my CLI tool, I would like to propose a solution that should enjoy everyone (I hope). I'll add patches that demonstrates this new cool feature ! Tell me what you think about it Laurent
 [2012-10-17 16:07 UTC] farell (Laurent Laville)
Hello, I've removed my patches becauses all the code are now included into the git repository See Pull Request https://github.com/pear/Console_CommandLine/pull/1 - Laurent
 [2014-04-12 23:12 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Closed -Assigned To: +Assigned To: farell
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.