$SYSTEM_ID = '127.0.0.1'; #------------------------------------------------------------------------------ $OPTS = Doku_Cli_Opts::getOptions(__FILE__, 'h::fm:u:s:t', array('help==', 'user='******'system=', 'trivial')); if ($OPTS->isError()) { print $OPTS->getMessage() . "\n"; exit(1); } if ($OPTS->has('h') or $OPTS->has('help') or !$OPTS->hasArgs()) { usage(getSuppliedArgument($OPTS, 'h', 'help')); exit(0); } if ($OPTS->has('u') or $OPTS->has('user')) { $USERNAME = getSuppliedArgument($OPTS, 'u', 'user'); } if ($OPTS->has('s') or $OPTS->has('system')) { $SYSTEM_ID = getSuppliedArgument($OPTS, 's', 'system'); } #------------------------------------------------------------------------------ switch ($OPTS->arg(0)) { #---------------------------------------------------------------------- case 'checkout': $WIKI_ID = $OPTS->arg(1); if (!$WIKI_ID) { fwrite(STDERR, "Wiki page ID required\n"); exit(1); } $WIKI_FN = wikiFN($WIKI_ID); if (!file_exists($WIKI_FN)) { fwrite(STDERR, "{$WIKI_ID} does not yet exist\n"); exit(1); }
$long_opts = array('help', 'examples', 'keep=', 'english'); $OPTS = Doku_Cli_Opts::getOptions(__FILE__, $short_opts, $long_opts); if ($OPTS->isError()) { fwrite(STDERR, $OPTS->getMessage() . "\n"); exit(1); } // handle '--examples' option $show_examples = ($OPTS->has('x') or $OPTS->has('examples')) ? true : false; // handle '--help' option if ($OPTS->has('h') or $OPTS->has('help')) { usage($show_examples); exit(0); } // handle both '--keep' and '--english' options if ($OPTS->has('k') or $OPTS->has('keep')) { $preserved_langs = getSuppliedArgument($OPTS, 'k', 'keep'); $langs = explode(',', $preserved_langs); // ! always enforce 'en' lang when using '--keep' (DW relies on it) if (!isset($langs['en'])) { $langs[] = 'en'; } } elseif ($OPTS->has('e') or $OPTS->has('english')) { // '--english' was specified strip everything besides 'en' $langs = array('en'); } else { // no option was specified, print usage but don't do anything as // this run might not be intented usage(); print "\n\n ERROR\n No option specified, use either -h -x to get more info,\n or -e to strip every language besides english.\n"; exit(1); }