Changed siganture to be clearer

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-06-28 22:26:37 -07:00
parent 2f7c04362e
commit a711e608c9

View file

@ -17,7 +17,7 @@ class GeneratePersonalAccessToken extends Command
* @var string * @var string
*/ */
protected $signature = 'snipeit:make-api-key protected $signature = 'snipeit:make-api-key
{user : The ID of the user to create the token for} {--user_id= : The ID of the user to create the token for.}
{--name= : The name of the new API token} {--name= : The name of the new API token}
{--key-only : Only return the value of the API key}'; {--key-only : Only return the value of the API key}';
@ -62,11 +62,11 @@ class GeneratePersonalAccessToken extends Command
$accessTokenName = 'CLI Auth Token'; $accessTokenName = 'CLI Auth Token';
} }
if ($this->argument('user')=='') { if ($this->option('user_id')=='') {
return false; return $this->error('ERROR: user_id cannot be blank.');
} }
if ($user = User::find($this->argument('user'))) { if ($user = User::find($this->option('user_id'))) {
if ($this->option('key-only')) { if ($this->option('key-only')) {
$this->info($user->createToken($accessTokenName)->accessToken); $this->info($user->createToken($accessTokenName)->accessToken);