Full Example Listing

Here's a full example listing demonstrating the typical usage of ClearIce. You are encouraged to copy and modify for your own use.


require "vendor/autoload.php";

use clearice\argparser\ArgumentParser;

$argumentParser = new ArgumentParser();
$argumentParser->addCommand(['name' => 'serve', 'help' => 'start a web server to serve the wiki']);
$argumentParser->addCommand(['name' => 'generate', 'help' => 'generate the output wiki']);

    'short_name' => 'o',
    'name' => 'output',
    'type' => 'string',
    'help' => 'specifies output directory of wiki',
    'value' => 'DIRECTORY',
    'required' => true,
    'command' => 'generate'
    'short_name' => 'i',
    'name' => 'input',
    'type' => 'string',
    'help' => 'specifies input sources for the wiki',
    'default' => '.',
    'command' => 'generate'
    'command' => 'serve',
    'short_name' => 'p',
    'name' => 'port',
    'type' => 'number',
    'value' => 'PORT',
    'help' => "specifies the port on which to run the server",
    'name' => 'verbose',
    'short_name' => 'v',
    'help' => "display detailed output of commands.",

    "Simple Wiki version 1.0\nA sample or should I say dummy wiki app "
    .   "to help explain ClearIce. This app practically does nothing.",
    "Hope you had a nice time learning about ClearIce. We're pretty sure "
    .   "your cli apps would no longer be boring to work with.\n\nReport bugs to "
    .   "bugs@clearice.tld"
$output = $argumentParser->parse();