@clerc/plugin-not-found 0.16.0 → 0.17.0

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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { definePlugin, NoSuchCommandError } from '@clerc/core';
1
+ import { definePlugin, NoSuchCommandError, NoCommandGivenError } from '@clerc/core';
2
2
  import { semanticArray } from '@clerc/utils';
3
3
  import didyoumean from 'didyoumean2';
4
- import pc from 'picocolors';
4
+ import * as colors from 'colorette';
5
5
 
6
6
  const notFoundPlugin = () => definePlugin({
7
7
  setup: (cli) => {
@@ -13,21 +13,21 @@ const notFoundPlugin = () => definePlugin({
13
13
  try {
14
14
  next();
15
15
  } catch (e) {
16
- if (!(e instanceof NoSuchCommandError)) {
16
+ if (!(e instanceof NoSuchCommandError || e instanceof NoCommandGivenError)) {
17
17
  throw e;
18
18
  }
19
19
  if (ctx.raw._.length === 0) {
20
20
  console.log("No command given.");
21
21
  if (hasCommands) {
22
- console.log(`Possible commands: ${pc.bold(semanticArray(commandKeys))}.`);
22
+ console.log(`Possible commands: ${colors.bold(semanticArray(commandKeys))}.`);
23
23
  }
24
24
  return;
25
25
  }
26
26
  const calledCommandName = e.message.replace("No such command: ", "");
27
27
  const closestCommandName = didyoumean(calledCommandName, commandKeys);
28
- console.log(`Command "${pc.strikethrough(calledCommandName)}" not found.`);
28
+ console.log(`Command "${colors.strikethrough(calledCommandName)}" not found.`);
29
29
  if (hasCommands && closestCommandName) {
30
- console.log(`Did you mean "${pc.bold(closestCommandName)}"?`);
30
+ console.log(`Did you mean "${colors.bold(closestCommandName)}"?`);
31
31
  } else if (!hasCommands) {
32
32
  console.log("NOTE: You haven't register any command yet.");
33
33
  }
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { definePlugin, NoSuchCommandError } from '@clerc/core';
1
+ import { definePlugin, NoSuchCommandError, NoCommandGivenError } from '@clerc/core';
2
2
  import { semanticArray } from '@clerc/utils';
3
3
  import didyoumean from 'didyoumean2';
4
- import pc from 'picocolors';
4
+ import * as colors from 'colorette';
5
5
 
6
6
  const notFoundPlugin = () => definePlugin({
7
7
  setup: (cli) => {
@@ -13,21 +13,21 @@ const notFoundPlugin = () => definePlugin({
13
13
  try {
14
14
  next();
15
15
  } catch (e) {
16
- if (!(e instanceof NoSuchCommandError)) {
16
+ if (!(e instanceof NoSuchCommandError || e instanceof NoCommandGivenError)) {
17
17
  throw e;
18
18
  }
19
19
  if (ctx.raw._.length === 0) {
20
20
  console.log("No command given.");
21
21
  if (hasCommands) {
22
- console.log(`Possible commands: ${pc.bold(semanticArray(commandKeys))}.`);
22
+ console.log(`Possible commands: ${colors.bold(semanticArray(commandKeys))}.`);
23
23
  }
24
24
  return;
25
25
  }
26
26
  const calledCommandName = e.message.replace("No such command: ", "");
27
27
  const closestCommandName = didyoumean(calledCommandName, commandKeys);
28
- console.log(`Command "${pc.strikethrough(calledCommandName)}" not found.`);
28
+ console.log(`Command "${colors.strikethrough(calledCommandName)}" not found.`);
29
29
  if (hasCommands && closestCommandName) {
30
- console.log(`Did you mean "${pc.bold(closestCommandName)}"?`);
30
+ console.log(`Did you mean "${colors.bold(closestCommandName)}"?`);
31
31
  } else if (!hasCommands) {
32
32
  console.log("NOTE: You haven't register any command yet.");
33
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/plugin-not-found",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
5
5
  "description": "Clerc plugin not found (did you mean)",
6
6
  "keywords": [
@@ -51,12 +51,12 @@
51
51
  "@clerc/core": "*"
52
52
  },
53
53
  "dependencies": {
54
+ "colorette": "^2.0.19",
54
55
  "didyoumean2": "^5.0.0",
55
- "picocolors": "^1.0.0",
56
- "@clerc/utils": "0.16.0"
56
+ "@clerc/utils": "0.17.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@clerc/core": "0.16.0"
59
+ "@clerc/core": "0.17.0"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "puild",