try { $opts = new Zend_Console_Getopt(array('help|h' => 'Display this help Message', 'verbose|v' => 'Output messages', 'dry|d' => "Dry run - don't change anything", 'info|i' => 'Get usage description of method', 'method=s' => 'Method to call [required]', 'username=s' => 'Username [required]', 'password=s' => 'Password', 'passwordfile=s' => 'Name of file that contains password')); $opts->parse(); } catch (Zend_Console_Getopt_Exception $e) { echo $e->getMessage() . "\n"; echo $e->getUsageMessage(); exit; } if (count($opts->toArray()) === 0 || $opts->h || empty($opts->method)) { echo $opts->getUsageMessage(); exit; } // get username / password if not already set if (!in_array($opts->method, $anonymousMethods)) { if (empty($opts->username)) { $opts->username = Tinebase_Server_Cli::promptInput('username'); } if (empty($opts->username)) { echo "error: username must be given! exiting \n"; exit(1); } if (empty($opts->password)) { if (empty($opts->passwordfile)) { $opts->password = Tinebase_Server_Cli::promptInput('password', TRUE); } else { $opts->password = Tinebase_Server_Cli::getPasswordFromFile($opts->passwordfile); } } } Tinebase_Core::set('opts', $opts); Tinebase_Core::dispatchRequest();