From 60b33cd3b1d8ef5804965b418e7cb85318fd1cc6 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 21 Sep 2020 07:42:53 +0000 Subject: [PATCH] Fix a type / add "list" command to relay cli --- src/Console/Relay.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Console/Relay.php b/src/Console/Relay.php index 5d7c8b3f70..ab994dc62c 100644 --- a/src/Console/Relay.php +++ b/src/Console/Relay.php @@ -47,12 +47,12 @@ class Relay extends \Asika\SimpleConsole\Console $help = << [-h|--help|-?] [-v] - bin/console relay remove [-h|--help|-?] [-v] + bin/console relay remove [-h|--help|-?] [-v] Description - bin/console relay + bin/console relay list Lists all active relay servers bin/console relay add @@ -88,11 +88,7 @@ HELP; throw new CommandArgsException('Too many arguments'); } - if (count($this->args) == 1) { - throw new CommandArgsException('Too few arguments'); - } - - if (count($this->args) == 0) { + if ((count($this->args) == 1) && ($this->getArgument(0) == 'list')) { $contacts = $this->dba->select('apcontact', ['url'], ["`type` = ? AND `url` IN (SELECT `url` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?))", 'Application', 0, Contact::FOLLOWER, Contact::FRIEND]); @@ -100,6 +96,10 @@ HELP; $this->out($contact['url']); } $this->dba->close($contacts); + } elseif (count($this->args) == 0) { + throw new CommandArgsException('too few arguments'); + } elseif (count($this->args) == 1) { + throw new CommandArgsException($this->getArgument(0) . ' is no valid command'); } if (count($this->args) == 2) {