diff --git a/bin/wantedpages.php b/bin/wantedpages.php
index edded6a22ac8f24e839139ab7dd4cc96cb64881a..a7f0ab70d6b50d5452efd626caf7cbc5b8fef044 100755
--- a/bin/wantedpages.php
+++ b/bin/wantedpages.php
@@ -44,14 +44,15 @@ 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') {
+        
+        $cmd = $options->getCmd();
+        if($cmd == 'show-pages') {
             $this->show_pages = true;
         }