1.0.0 Alpha Release #59

Merged
netkas merged 213 commits from v1.0.0_alpha into master 2023-01-29 23:27:58 +00:00
Showing only changes of commit bb8d8683c0 - Show all commits

View file

@ -40,6 +40,7 @@ namespace ncc\CLI\Management;
* *
* @param $args * @param $args
* @return void * @return void
* @noinspection DuplicatedCode
*/ */
public static function start($args): void public static function start($args): void
{ {
@ -209,7 +210,7 @@ namespace ncc\CLI\Management;
$username = $args['username'] ?? $args['usr'] ?? null; $username = $args['username'] ?? $args['usr'] ?? null;
$password = $args['password'] ?? $args['pwd'] ?? null; $password = $args['password'] ?? $args['pwd'] ?? null;
$token = $args['token'] ?? $args['pat'] ?? $args['private-token'] ?? null; $token = $args['token'] ?? $args['pat'] ?? $args['private-token'] ?? null;
$encrypt = $args['encrypt'] ?? $args['encrypted'] ?? null; $encrypt = !isset($args['no-encryption']);
if($name === null) if($name === null)
$name = Console::getInput('Enter a name for the entry: '); $name = Console::getInput('Enter a name for the entry: ');
@ -235,9 +236,6 @@ namespace ncc\CLI\Management;
Console::outError('Invalid authentication type'); Console::outError('Invalid authentication type');
} }
if($encrypt === null)
$encrypt = Console::getBooleanInput('Encrypt entry with your password?');
if($name === null) if($name === null)
{ {
Console::outError('You must specify a name for the entry (alias, name)', true, 1); Console::outError('You must specify a name for the entry (alias, name)', true, 1);
@ -373,7 +371,7 @@ namespace ncc\CLI\Management;
Console::outHelpSections([ Console::outHelpSections([
new CliHelpSection(['--name'], 'The name of the entry'), new CliHelpSection(['--name'], 'The name of the entry'),
new CliHelpSection(['--auth-type', '--auth'], 'The type of authentication (login, pat)'), new CliHelpSection(['--auth-type', '--auth'], 'The type of authentication (login, pat)'),
new CliHelpSection(['--encrypted', '--encrypt'], 'Whether or not to encrypt the entry', true), new CliHelpSection(['--no-encryption'], 'Omit encryption to the entry (By default it\'s encrypted)', true),
]); ]);
Console::out(' login authentication type options:'); Console::out(' login authentication type options:');
@ -392,8 +390,8 @@ namespace ncc\CLI\Management;
Console::out(' pat' . PHP_EOL); Console::out(' pat' . PHP_EOL);
Console::out('Examples:'); Console::out('Examples:');
Console::out(' ncc cred add --alias "My Alias" --auth-type login --username "myusername" --password "mypassword" --encrypt'); Console::out(' ncc cred add --alias "My Alias" --auth-type login --username "myusername" --password "mypassword"');
Console::out(' ncc cred add --alias "My Alias" --auth-type pat --token "mytoken"'); Console::out(' ncc cred add --alias "My Alias" --auth-type pat --token "mytoken" --no-encryption');
Console::out(' ncc cred remove --alias "My Alias"'); Console::out(' ncc cred remove --alias "My Alias"');
} }
} }