Example #1
0
 * phpVocab is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * Artistic License for more details.
 *
 * You should have received a copy of the Artistic License
 * along with phpVocab. If not, see <http://www.phpVocab.com/license.php>
 * or <http://www.opensource.org/licenses/artistic-license-2.0.php>.
 *
 * @author James Frasca <*****@*****.**>
 * @copyright Copyright 2009, James Frasca, All Rights Reserved
 */
// Set up the environment
require_once __DIR__ . '/include.php';
// Get the command line argument parser
$cliParser = \vc\Provider\CLI::getArgParser();
// Attempt to parse the input arguments
try {
    $result = $cliParser->process();
} catch (\r8\Exception\Data $err) {
    echo "Error!\n" . $err->getMessage() . "\n" . "For details about using this command, use the '--help' option\n\n";
    exit;
}
// If they requested version...
if ($result->flagExists('v')) {
    echo "PHP Vocab, version " . VOCAB_VERSION . " - http://vocab.roundeights.com\n" . "Round Eights, version " . r8_VERSION . " - http://www.roundeights.com\n\n";
    exit;
} else {
    if ($result->flagExists('h') || $result->countArgs() == 0) {
        echo $cliParser->getHelp();
        exit;
Example #2
0
 public function testgetArgParser()
 {
     $cmd = \vc\Provider\CLI::getArgParser();
     $this->assertThat($cmd, $this->isInstanceOf('\\r8\\CLI\\Command'));
 }