Skip to content

Commit e0bb9a5

Browse files
authored
Refactor command help text definitions for Symfony Console compatibility (#645)
1 parent eadccb5 commit e0bb9a5

9 files changed

+20
-27
lines changed

Console/AddKeyIntoKeysetCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616
use function is_array;
1717
use function is_string;
1818

19-
#[AsCommand(name: 'keyset:add:key', description: 'Add a key into a key set.', help: <<<'TXT'
20-
This command adds a key at the end of a key set.
21-
TXT)]
19+
#[AsCommand(name: 'keyset:add:key', description: 'Add a key into a key set.')]
2220
final class AddKeyIntoKeysetCommand extends ObjectOutputCommand
2321
{
2422
#[Override]
2523
protected function configure(): void
2624
{
2725
parent::configure();
2826
$this
27+
->setHelp('This command adds a key at the end of a key set.')
2928
->addArgument('jwkset', InputArgument::REQUIRED, 'The JWKSet object')
3029
->addArgument('jwk', InputArgument::REQUIRED, 'The new JWK object');
3130
}

Console/JKULoaderCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
use Symfony\Component\Console\Output\OutputInterface;
1414
use function is_string;
1515

16-
#[AsCommand(name: 'keyset:load:jku', description: 'Loads a key set from an url.', help: <<<'TXT'
17-
This command will try to get a key set from an URL. The distant key set is a JWKSet.
18-
TXT)]
16+
#[AsCommand(name: 'keyset:load:jku', description: 'Loads a key set from an url.')]
1917
final class JKULoaderCommand extends ObjectOutputCommand
2018
{
2119
public function __construct(
@@ -30,6 +28,7 @@ protected function configure(): void
3028
{
3129
parent::configure();
3230
$this
31+
->setHelp('This command will try to get a key set from an URL. The distant key set is a JWKSet.')
3332
->addArgument('url', InputArgument::REQUIRED, 'The URL');
3433
}
3534

Console/KeyAnalyzerCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
use function is_array;
1919
use function is_string;
2020

21-
#[AsCommand(name: 'key:analyze', description: 'JWK quality analyzer.', help: <<<'TXT'
22-
This command will analyze a JWK object and find security issues.
23-
TXT)]
21+
#[AsCommand(name: 'key:analyze', description: 'JWK quality analyzer.')]
2422
final class KeyAnalyzerCommand extends Command
2523
{
2624
public function __construct(
@@ -35,6 +33,7 @@ protected function configure(): void
3533
{
3634
parent::configure();
3735
$this
36+
->setHelp('This command will analyze a JWK object and find security issues.')
3837
->addArgument('jwk', InputArgument::REQUIRED, 'The JWK object');
3938
}
4039

Console/KeysetAnalyzerCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
use function is_string;
2222
use function sprintf;
2323

24-
#[AsCommand(name: 'keyset:analyze', description: 'JWKSet quality analyzer.', help: <<<'TXT'
25-
This command will analyze a JWKSet object and find security issues.
26-
TXT)]
24+
#[AsCommand(name: 'keyset:analyze', description: 'JWKSet quality analyzer.')]
2725
final class KeysetAnalyzerCommand extends Command
2826
{
2927
public function __construct(
@@ -39,6 +37,7 @@ protected function configure(): void
3937
{
4038
parent::configure();
4139
$this
40+
->setHelp('This command will analyze a JWKSet object and find security issues.')
4241
->addArgument('jwkset', InputArgument::REQUIRED, 'The JWKSet object');
4342
}
4443

Console/MergeKeysetCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@
1414
use Symfony\Component\Console\Output\OutputInterface;
1515
use function is_array;
1616

17-
#[AsCommand(name: 'keyset:merge', description: 'Merge several key sets into one.', help: <<<'TXT'
18-
This command merges several key sets into one. It is very useful when you generate e.g. RSA, EC and OKP keys and you want only one key set to rule them all.
19-
TXT)]
17+
#[AsCommand(name: 'keyset:merge', description: 'Merge several key sets into one.')]
2018
final class MergeKeysetCommand extends ObjectOutputCommand
2119
{
2220
#[Override]
2321
protected function configure(): void
2422
{
2523
parent::configure();
2624
$this
25+
->setHelp(
26+
'This command merges several key sets into one. It is very useful when you generate e.g. RSA, EC and OKP keys and you want only one key set to rule them all.'
27+
)
2728
->addArgument('jwksets', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'The JWKSet objects');
2829
}
2930

Console/PublicKeyCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
#[AsCommand(
1919
name: 'key:convert:public',
2020
description: 'Convert a private key into public key. Symmetric keys (shared keys) are not changed.',
21-
help: <<<'TXT'
22-
This command converts a private key into a public key.
23-
TXT
2421
)]
2522
final class PublicKeyCommand extends ObjectOutputCommand
2623
{
@@ -29,6 +26,7 @@ protected function configure(): void
2926
{
3027
parent::configure();
3128
$this
29+
->setHelp('This command converts a private key into a public key.')
3230
->addArgument('jwk', InputArgument::REQUIRED, 'The JWK object');
3331
}
3432

Console/PublicKeysetCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
#[AsCommand(
1919
name: 'keyset:convert:public',
2020
description: 'Convert private keys in a key set into public keys. Symmetric keys (shared keys) are not changed.',
21-
help: <<<'TXT'
22-
This command converts private keys in a key set into public keys.
23-
TXT
2421
)]
2522
final class PublicKeysetCommand extends ObjectOutputCommand
2623
{
@@ -29,6 +26,7 @@ protected function configure(): void
2926
{
3027
parent::configure();
3128
$this
29+
->setHelp('This command converts private keys in a key set into public keys.')
3230
->addArgument('jwkset', InputArgument::REQUIRED, 'The JWKSet object');
3331
}
3432

Console/RotateKeysetCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@
1717
use function is_array;
1818
use function is_string;
1919

20-
#[AsCommand(name: 'keyset:rotate', description: 'Rotate a key set.', help: <<<'TXT'
21-
This command removes the last key in a key set a place a new one at the beginning.
22-
TXT)]
20+
#[AsCommand(name: 'keyset:rotate', description: 'Rotate a key set.')]
2321
final class RotateKeysetCommand extends ObjectOutputCommand
2422
{
2523
#[Override]
2624
protected function configure(): void
2725
{
2826
parent::configure();
2927
$this
28+
->setHelp('This command removes the last key in a key set a place a new one at the beginning.')
3029
->addArgument('jwkset', InputArgument::REQUIRED, 'The JWKSet object')
3130
->addArgument('jwk', InputArgument::REQUIRED, 'The new JWK object');
3231
}

Console/X5ULoaderCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
use Symfony\Component\Console\Output\OutputInterface;
1414
use function is_string;
1515

16-
#[AsCommand(name: 'keyset:load:x5u', description: 'Loads a key set from an url.', help: <<<'TXT'
17-
This command will try to get a key set from an URL. The distant key set is list of X.509 certificates.
18-
TXT)]
16+
#[AsCommand(name: 'keyset:load:x5u', description: 'Loads a key set from an url.')]
1917
final class X5ULoaderCommand extends ObjectOutputCommand
2018
{
2119
public function __construct(
@@ -30,6 +28,9 @@ protected function configure(): void
3028
{
3129
parent::configure();
3230
$this
31+
->setHelp(
32+
'This command will try to get a key set from an URL. The distant key set is list of X.509 certificates.'
33+
)
3334
->addArgument('url', InputArgument::REQUIRED, 'The URL');
3435
}
3536

0 commit comments

Comments
 (0)