From f2262b692a0ba895303a2595c0cea1efd1535166 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 22 Oct 2013 19:05:49 +0200 Subject: [PATCH] add feed/list command, show help when no feed command given --- src/stapibas/Cli.php | 13 +++++++++++-- src/stapibas/Feed/Manage.php | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/stapibas/Cli.php b/src/stapibas/Cli.php index 40d9d17..88a8cc5 100644 --- a/src/stapibas/Cli.php +++ b/src/stapibas/Cli.php @@ -63,10 +63,12 @@ class Cli $mg = new Feed_Manage($deps); if ($command->command_name == 'add') { $mg->addFeed($command->command->args['feed']); - } else if ($command->command_name == 'remove') { + } else if ($command->command_name == 'remove') { $mg->removeFeed($command->command->args['feed']); - } else { + } else if ($command->command_name == 'list') { $mg->listAll(); + } else { + $this->cliParser->commands['feed']->displayUsage(1); } } @@ -190,6 +192,13 @@ class Cli ); $add->addArgument('feed', array('description' => 'URL of feed')); + $feed->addCommand( + 'list', + array( + 'description' => 'List all feeds', + ) + ); + $remove = $feed->addCommand( 'remove', array( diff --git a/src/stapibas/Feed/Manage.php b/src/stapibas/Feed/Manage.php index 0db50ab..e8e6f25 100644 --- a/src/stapibas/Feed/Manage.php +++ b/src/stapibas/Feed/Manage.php @@ -22,7 +22,7 @@ class Feed_Manage echo '#' . $feedRow->f_id . ' ' . $feedRow->f_url . "\n"; ++$items; } - $this->log->info('Finished pinging %d URLs.', $items); + $this->log->info('Finished listing %d URLs.', $items); } public function addFeed($url) -- 2.30.2