Example #1
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = new Horde_Argv_InterceptingParser();
     $this->parser->addOption('-n', array('type' => 'int'));
     $this->parser->addOption('-l', array('type' => 'long'));
 }
Example #2
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = new Horde_Argv_Parser();
     $this->parser->addOption('-v', '--verbose', '-n', '--noisy', array('action' => 'store_true', 'dest' => 'verbose'));
     $this->parser->addOption('-q', '--quiet', '--silent', array('action' => 'store_false', 'dest' => 'verbose'));
 }
 public function setUp()
 {
     parent::setUp();
     $this->parser = new Horde_Argv_InterceptingParser(array('usage' => Horde_Argv_Option::SUPPRESS_USAGE));
     $this->parser->setConflictHandler('resolve');
     $this->parser->addOption('-n', '--dry-run', array('action' => 'store_true', 'dest' => 'dry_run', 'help' => "don't do anything"));
     $this->parser->addOption('--dry-run', '-n', array('action' => 'store_const', 'const' => 42, 'dest' => 'dry_run', 'help' => 'dry run mode'));
 }
 public function setUp()
 {
     parent::setUp();
     $this->parser = new Horde_Argv_InterceptingParser(array('usage' => Horde_Argv_Option::SUPPRESS_USAGE));
     $this->parser->addOption("-p", "--point", array('action' => "store", 'nargs' => 3, 'type' => 'float', 'dest' => 'point'));
     $this->parser->addOption("-f", "--foo", array('action' => "append", 'nargs' => 2, 'type' => "int", 'dest' => "foo"));
     $this->parser->addOption("-z", "--zero", array('action' => "append_const", 'dest' => "foo", 'const' => array(0, 0)));
 }
Example #5
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = new Horde_Argv_InterceptingParser(array('usage' => Horde_Argv_Option::SUPPRESS_USAGE));
     $this->vOpt = $this->makeOption('-v', array('action' => 'count', 'dest' => 'verbose'));
     $this->parser->addOption($this->vOpt);
     $this->parser->addOption('--verbose', array('type' => 'int', 'dest' => 'verbose'));
     $this->parser->addOption('-q', '--quiet', array('action' => 'store_const', 'dest' => 'verbose', 'const' => 0));
 }
Example #6
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = $this->makeParser(80);
     $this->origColumns = isset($_ENV['COLUMNS']) ? $_ENV['COLUMNS'] : null;
     if (!isset($_SERVER['argv'])) {
         $_SERVER['argv'] = array('test');
     }
 }
Example #7
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = new Horde_Argv_InterceptingParser(array('usage' => Horde_Argv_Option::SUPPRESS_USAGE, 'optionClass' => 'Horde_Argv_ExtendAddTypesTest_MyOption'));
     $this->parser->addOption("-a", null, array('type' => "string", 'dest' => "a"));
     $this->parser->addOption("-f", "--file", array('type' => "file", 'dest' => "file"));
     /* @todo make more system independent */
     $this->testPath = tempnam('/tmp', 'horde_argv');
 }
 public function setUp()
 {
     parent::setUp();
     $options = array();
     for ($i = -1; $i > -6; $i--) {
         $options[] = $this->makeOption((string) $i, array('action' => 'callback', 'callback' => array($this, 'process_n'), 'dest' => 'things'));
     }
     $this->parser = new Horde_Argv_Parser(array('optionList' => $options));
 }
Example #9
0
    public function setUp()
    {
        parent::setUp();
        $this->parser = new Horde_Argv_Parser(array('prog' => 'test'));
        $this->help_prefix = 'Usage: test [options]

Options:
  -h, --help            show this help message and exit';
        $this->file_help = "read from FILE [default: %default]";
        $this->expected_help_file = $this->help_prefix . "\n" . "  -f FILE, --file=FILE  read from FILE [default: foo.txt]\n";
        $this->expected_help_none = $this->help_prefix . "\n" . "  -f FILE, --file=FILE  read from FILE [default: none]\n";
    }
Example #10
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = new Horde_Argv_Parser();
     $this->parser->addOption('-v', '--verbose', array('default' => true));
     $this->parser->addOption('-q', '--quiet', array('dest' => 'verbose'));
     $this->parser->addOption('-n', array('type' => 'int', 'default' => 37));
     $this->parser->addOption('-m', array('type' => 'int'));
     $this->parser->addOption('-s', array('default' => 'foo'));
     $this->parser->addOption('-t');
     $this->parser->addOption('-u', array('default' => null));
     $this->expected = array('verbose' => true, 'n' => 37, 'm' => null, 's' => 'foo', 't' => null, 'u' => null);
 }
 public function setUp()
 {
     parent::setUp();
     $options = array($this->makeOption('-p', '--point', array('action' => 'callback', 'callback' => array($this, 'processTuple'), 'callbackArgs' => array(3, 'int'), 'type' => 'string', 'dest' => 'points', 'default' => array())));
     $this->parser = new Horde_Argv_Parser(array('optionList' => $options));
 }
Example #12
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = new Horde_Argv_Parser(array('usage' => Horde_Argv_Option::SUPPRESS_USAGE));
 }
Example #13
0
 public function setUp()
 {
     parent::setUp();
     $options = array(new Horde_Argv_ExtendAddActionsTest_MyOption("-a", "--apple", array('action' => "extend", 'type' => "string", 'dest' => "apple")));
     $this->parser = new Horde_Argv_Parser(array('optionList' => $options));
 }
Example #14
0
 public function setUp()
 {
     parent::setUp();
     $options = array($this->makeOption('-v', '--verbose', array('action' => 'store_true', 'dest' => 'verbose', 'default' => '')), $this->makeOption('-q', '--quiet', array('action' => 'store_false', 'dest' => 'verbose')));
     $this->parser = new Horde_Argv_Parser(array('optionList' => $options));
 }
 public function setUp()
 {
     parent::setUp();
     $this->parser = new Horde_Argv_Parser();
     $this->parser->addOption('--foo-bar', array('action' => 'callback', 'callback' => array($this, 'checkAbbrev')));
 }
Example #16
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = new Horde_Argv_InterceptingParser(array('usage' => Horde_Argv_Option::SUPPRESS_USAGE));
     $this->parser->addOption("-p", "--point", array('action' => "store", 'nargs' => 3, 'type' => "float", 'dest' => "point"));
 }
Example #17
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = new Horde_Argv_Parser();
 }
Example #18
0
 public function setUp()
 {
     parent::setUp();
     $options = array($this->makeOption('-a', array('type' => 'string')), $this->makeOption('-b', '--boo', array('type' => 'int', 'dest' => 'boo')), $this->makeOption('--foo', array('action' => 'append')));
     $this->parser = new Horde_Argv_InterceptingParser(array('usage' => Horde_Argv_Option::SUPPRESS_USAGE, 'optionList' => $options));
 }
Example #19
0
 public function setUp()
 {
     parent::setUp();
     $options = array(new Horde_Argv_Option('-x', null, array('action' => 'callback', 'callback' => array($this, 'processOpt'))), new Horde_Argv_Option('-f', '--file', array('action' => 'callback', 'callback' => array($this, 'processOpt'), 'type' => 'string', 'dest' => 'filename')));
     $this->parser = new Horde_Argv_Parser(array('optionList' => $options));
 }
Example #20
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = new Horde_Argv_InterceptingParser(array('usage' => Horde_Argv_Option::SUPPRESS_USAGE));
     $this->parser->addOption('-c', array('action' => 'store', 'type' => 'choice', 'dest' => 'choice', 'choices' => array('one', 'two', 'three')));
 }
Example #21
0
 public function setUp()
 {
     parent::setUp();
     $options = array($this->makeOption('-a', array('type' => 'int', 'nargs' => 2, 'dest' => 'a')), $this->makeOption('-b', array('action' => 'store_true', 'dest' => 'b')), $this->makeOption('-c', '--callback', array('action' => 'callback', 'callback' => array($this, 'variableArgs'), 'dest' => 'c')));
     $this->parser = new Horde_Argv_InterceptingParser(array('usage' => Horde_Argv_Option::SUPPRESS_USAGE, 'optionList' => $options));
 }
Example #22
0
 public function setUp()
 {
     parent::setUp();
     $options = array($this->makeOption('-a', '--apple', array('action' => 'callback', 'nargs' => 2, 'callback' => array($this, 'processMany'), 'type' => 'string')), $this->makeOption('-b', '--bob', array('action' => 'callback', 'nargs' => 3, 'callback' => array($this, 'processMany'), 'type' => 'int')));
     $this->parser = new Horde_Argv_Parser(array('optionList' => $options));
 }