@contentstack/cli-auth 2.0.0-beta.14 → 2.0.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth
18
18
  $ csdx COMMAND
19
19
  running command...
20
20
  $ csdx (--version)
21
- @contentstack/cli-auth/2.0.0-beta.14 linux-x64 node-v22.23.0
21
+ @contentstack/cli-auth/2.0.0-beta.15 linux-x64 node-v22.23.1
22
22
  $ csdx --help [COMMAND]
23
23
  USAGE
24
24
  $ csdx COMMAND
@@ -212,11 +212,10 @@ Removes selected tokens
212
212
 
213
213
  ```
214
214
  USAGE
215
- $ csdx auth:tokens:remove [-a <value>] [-i]
215
+ $ csdx auth:tokens:remove [-a <value>]
216
216
 
217
217
  FLAGS
218
218
  -a, --alias=<value> Alias (name) of the token to delete.
219
- -i, --ignore Ignores if the token is not present.
220
219
 
221
220
  DESCRIPTION
222
221
  Removes selected tokens
@@ -9,17 +9,20 @@ class TokensRemoveCommand extends base_command_1.BaseCommand {
9
9
  const { flags: removeTokenFlags } = await this.parse(TokensRemoveCommand);
10
10
  cli_utilities_1.log.debug('Token removal flags parsed.', Object.assign(Object.assign({}, this.contextDetails), { flags: removeTokenFlags }));
11
11
  const alias = removeTokenFlags.alias;
12
- const ignore = removeTokenFlags.ignore;
13
- cli_utilities_1.log.debug('Token removal parameters set.', Object.assign(Object.assign({}, this.contextDetails), { alias, ignore }));
12
+ cli_utilities_1.log.debug('Token removal parameters set.', Object.assign(Object.assign({}, this.contextDetails), { alias }));
14
13
  try {
15
14
  cli_utilities_1.log.debug('Retrieving token from configuration.', Object.assign(Object.assign({}, this.contextDetails), { alias }));
16
15
  const token = cli_utilities_1.configHandler.get(`tokens.${alias}`);
17
16
  cli_utilities_1.log.debug('Token retrieved from configuration.', Object.assign(Object.assign({}, this.contextDetails), { hasToken: !!token, tokenType: token === null || token === void 0 ? void 0 : token.type }));
17
+ if (alias && !token) {
18
+ cli_utilities_1.log.debug('Alias provided but token not found.', Object.assign(Object.assign({}, this.contextDetails), { alias }));
19
+ return cli_utilities_1.cliux.print(`No token found with alias '${alias}'.`, { color: 'yellow' });
20
+ }
18
21
  const tokens = cli_utilities_1.configHandler.get('tokens');
19
22
  cli_utilities_1.log.debug('All tokens retrieved from configuration.', Object.assign(Object.assign({}, this.contextDetails), { tokenCount: tokens ? Object.keys(tokens).length : 0 }));
20
23
  const tokenOptions = [];
21
- if (token || ignore) {
22
- cli_utilities_1.log.debug('Token found, or ignore flag set.', Object.assign(Object.assign({}, this.contextDetails), { hasToken: !!token, ignore }));
24
+ if (token) {
25
+ cli_utilities_1.log.debug('Token found.', Object.assign(Object.assign({}, this.contextDetails), { hasToken: !!token }));
23
26
  cli_utilities_1.configHandler.delete(`tokens.${alias}`);
24
27
  cli_utilities_1.log.debug('Token removed from configuration.', Object.assign(Object.assign({}, this.contextDetails), { alias }));
25
28
  return cli_utilities_1.cliux.success(`CLI_AUTH_TOKENS_REMOVE_SUCCESS`);
@@ -74,5 +77,4 @@ TokensRemoveCommand.description = 'Removes selected tokens';
74
77
  TokensRemoveCommand.examples = ['$ csdx auth:tokens:remove', '$ csdx auth:tokens:remove -a <alias>'];
75
78
  TokensRemoveCommand.flags = {
76
79
  alias: cli_utilities_1.flags.string({ char: 'a', description: 'Alias (name) of the token to delete.' }),
77
- ignore: cli_utilities_1.flags.boolean({ char: 'i', description: 'Ignores if the token is not present.' }),
78
80
  };
@@ -416,13 +416,6 @@
416
416
  "hasDynamicHelp": false,
417
417
  "multiple": false,
418
418
  "type": "option"
419
- },
420
- "ignore": {
421
- "char": "i",
422
- "description": "Ignores if the token is not present.",
423
- "name": "ignore",
424
- "allowNo": false,
425
- "type": "boolean"
426
419
  }
427
420
  },
428
421
  "hasDynamicHelp": false,
@@ -442,5 +435,5 @@
442
435
  ]
443
436
  }
444
437
  },
445
- "version": "2.0.0-beta.14"
438
+ "version": "2.0.0-beta.15"
446
439
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contentstack/cli-auth",
3
3
  "description": "Contentstack CLI plugin for authentication activities",
4
- "version": "2.0.0-beta.14",
4
+ "version": "2.0.0-beta.15",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "scripts": {