diff --git a/bin/wantedpages.php b/bin/wantedpages.php index 44254a8ecb336846fb4c8fc6ed374b8539a5a8c1..edded6a22ac8f24e839139ab7dd4cc96cb64881a 100755 --- a/bin/wantedpages.php +++ b/bin/wantedpages.php @@ -12,7 +12,7 @@ class WantedPagesCLI extends DokuCLI { const DIR_CONTINUE = 1; const DIR_NS = 2; const DIR_PAGE = 3; - + private $show_pages = false; /** * Register options and arguments on the given $options object * @@ -28,6 +28,11 @@ class WantedPagesCLI extends DokuCLI { 'The namespace to lookup. Defaults to root namespace', false ); + $options->registerCommand( + 'show-pages', + 'Show wiki pages on which broken links (i.e. wanted pages) are found, listed as: wiki_page=>broken_link' + ); + } /** @@ -39,12 +44,16 @@ class WantedPagesCLI extends DokuCLI { * @return void */ protected function main(DokuCLI_Options $options) { + global $argc, $argv; if($options->args) { $startdir = dirname(wikiFN($options->args[0].':xxx')); } else { $startdir = dirname(wikiFN('xxx')); } + if($argv[1] == 'show-pages' || $argv[2] == 'show-pages') { + $this->show_pages = true; + } $this->info("searching $startdir"); @@ -141,7 +150,10 @@ class WantedPagesCLI extends DokuCLI { resolve_pageid($cns, $mid, $exists); if(!$exists) { list($mid) = explode('#', $mid); //record pages without hashs + if($this->show_pages) { $links[] = "$pid => $mid"; + } + else $links[] = $mid; } } }