1
0
Fork 0
mirror of https://github.com/MetaProvide/talked-client.git synced 2025-04-17 02:07:50 +00:00

Add help command to present the different options

This commit is contained in:
Magnus Walbeck 2021-08-19 14:44:09 +02:00
parent 3755f61908
commit 754b9f5f28
Signed by: mwalbeck
GPG key ID: CCB78CFF3F950769

View file

@ -56,20 +56,22 @@ class Record extends Command
->setDescription('Call recording for Nextcloud Talk') ->setDescription('Call recording for Nextcloud Talk')
->addArgument( ->addArgument(
'token', 'token',
InputArgument::REQUIRED InputArgument::REQUIRED,
'A Talk room token.'
) )
->addArgument( ->addArgument(
'argument', 'cmd',
InputArgument::REQUIRED InputArgument::OPTIONAL,
'The command to run, the following are valid commands: info, status, start, stop and help.',
'help'
) )
->setHelp('/recording')
; ;
} }
protected function execute(InputInterface $input, OutputInterface $output): int protected function execute(InputInterface $input, OutputInterface $output): int
{ {
$token = $input->getArgument('token'); $token = $input->getArgument('token');
$argument = $input->getArgument('argument'); $cmd = $input->getArgument('cmd');
$serverUrl = $this->config->getAppValue('talked', 'server_url', ''); $serverUrl = $this->config->getAppValue('talked', 'server_url', '');
if ($serverUrl === '') { if ($serverUrl === '') {
@ -77,7 +79,21 @@ class Record extends Command
return 0; return 0;
} }
if ($argument === 'info') { if ($cmd === 'help' or $cmd === '') {
$message = 'Talked - Call recording for Nextcloud Talk
You have the following options available:
/recording start - Starts a call recording
/recording stop - Stops the call recording
/recording status - Checks if there is an active call recording
';
$output->writeln($message);
return 0;
}
if ($cmd === 'info') {
$result = $this->sendGetRequest($serverUrl, ''); $result = $this->sendGetRequest($serverUrl, '');
$output->writeln($result); $output->writeln($result);
@ -85,7 +101,7 @@ class Record extends Command
return 0; return 0;
} }
if ($argument === 'status') { if ($cmd === 'status') {
$payload = [ $payload = [
'token' => $token 'token' => $token
]; ];
@ -97,7 +113,7 @@ class Record extends Command
return 0; return 0;
} }
if ($argument === 'start') { if ($cmd === 'start') {
$payload = [ $payload = [
'token' => $token 'token' => $token
]; ];
@ -109,7 +125,7 @@ class Record extends Command
return 0; return 0;
} }
if ($argument === 'stop') { if ($cmd === 'stop') {
$payload = [ $payload = [
'token' => $token 'token' => $token
]; ];