예제 #1
0
 public function arguments($args)
 {
     $args->add('version')->suggestions(function () {
         $releaseList = ReleaseList::getReadyInstance();
         $releases = $releaseList->getReleases();
         $collection = new ValueCollection();
         foreach ($releases as $major => $versions) {
             $collection->group($major, "PHP {$major}", array_keys($versions));
         }
         $collection->group('pseudo', 'pseudo', array('latest', 'next'));
         return $collection;
     });
 }
예제 #2
0
 public function arguments($args)
 {
     $args->add('version')->suggestions(function () {
         $releaseList = ReleaseList::getReadyInstance();
         $releases = $releaseList->getReleases();
         $collection = new ValueCollection();
         foreach ($releases as $major => $versions) {
             $collection->group($major, "PHP {$major}", array_keys($versions));
         }
         $collection->group('pseudo', 'pseudo', array('latest', 'next'));
         return $collection;
     });
     $args->add('variants')->multiple()->suggestions(function () {
         $variants = new VariantBuilder();
         $list = $variants->getVariantNames();
         sort($list);
         return array_map(function ($n) {
             return '+' . $n;
         }, $list);
     });
 }
예제 #3
0
 public function arguments($args)
 {
     $args->add('user')->validValues(function () {
         $values = new ValueCollection();
         $values->group('authors', 'Authors', array('abba' => 'ABBA', 'michael' => 'Michael Jackson', 'adele' => 'Adele', 'air' => 'Air', 'alicia' => 'Alicia Keys', 'andras' => 'Andras Schiff'));
         $values->group('admins', 'Administrators', array('admin1', 'admin2', 'admin3'));
         $values->group('users', 'Users', array('userA', 'userB', 'userC'));
         $values->group('extension', 'PHP Extensions', get_loaded_extensions());
         $funcs = get_defined_functions();
         $values->group('internal-functions', 'PHP Internal Functions', $funcs['internal']);
         $values->group('user-functions', 'PHP User-defined Functions', $funcs['user']);
         return $values;
     });
     $args->add('repo')->validValues(array('CLIFramework', 'GetOptionKit', 'PHPBrew', 'AssetKit', 'ActionKit'));
     $args->add('file')->isa('file')->glob('*.php')->multiple();
 }
예제 #4
0
 public function test()
 {
     $groups = new ValueCollection();
     $groups->group('extension-commands', 'Extension Commands', array('install', 'enable', 'disable'));
     $groups->group('version-related', 'Version Related Commands', array('use', 'switch', 'off'));
     foreach ($groups as $groupId => $values) {
         ok($values);
     }
     $values = $groups->getGroup('extension-commands');
     ok($values);
     ok(is_array($values));
     ok($groups->containsValue('disable'));
     ok(!$groups->containsValue('foobar'));
     $json = $groups->toJson();
     ok($json);
 }