@clerc/plugin-help 1.0.2 → 1.0.3

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.d.ts CHANGED
@@ -1,26 +1,6 @@
1
1
  import { Plugin } from "@clerc/core";
2
+ import { FlagDefaultValue, TypeValue } from "@clerc/parser";
2
3
 
3
- //#region ../parser/src/types.d.ts
4
- interface FlagDefaultValueFunction<T> {
5
- (): T;
6
- display?: string;
7
- }
8
- type FlagDefaultValue<T = unknown> = T | FlagDefaultValueFunction<T>;
9
- /**
10
- * Defines how a string input is converted to the target type T.
11
- *
12
- * @template T The target type.
13
- */
14
- interface TypeFunction<T = unknown> {
15
- (value: string): T;
16
- /**
17
- * Optional display name for the type, useful in help output.
18
- * If provided, this will be shown instead of the function name.
19
- */
20
- display?: string;
21
- }
22
- type TypeValue<T = unknown> = TypeFunction<T> | readonly [TypeFunction<T>];
23
- //#endregion
24
4
  //#region src/types.d.ts
25
5
  interface Formatters {
26
6
  formatTypeValue: (type: TypeValue) => string;
package/dist/index.js CHANGED
@@ -1,17 +1,9 @@
1
1
  import { DOUBLE_DASH, NoSuchCommandError, definePlugin, normalizeFlagValue, normalizeParameterValue, resolveCommand } from "@clerc/core";
2
+ import { formatFlagName, formatVersion, isTruthy, objectIsEmpty, toArray } from "@clerc/utils";
2
3
  import * as tint from "@uttr/tint";
3
4
  import stringWidth from "string-width";
4
5
  import textTable from "text-table";
5
6
 
6
- //#region ../utils/src/index.ts
7
- const toArray = (a) => Array.isArray(a) ? a : [a];
8
- const kebabCase = (s) => s.replace(/([A-Z])/g, (_, c) => `-${c.toLowerCase()}`);
9
- const formatFlagName = (n) => n.length <= 1 ? `-${n}` : `--${kebabCase(n)}`;
10
- const formatVersion = (v) => v.length === 0 ? "" : v.startsWith("v") ? v : `v${v}`;
11
- const isTruthy = Boolean;
12
- const objectIsEmpty = (obj) => Object.keys(obj).length === 0;
13
-
14
- //#endregion
15
7
  //#region src/utils.ts
16
8
  function formatTypeValue(type) {
17
9
  if (typeof type === "function") return type.display ?? type.name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/plugin-help",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "type": "module",
6
6
  "description": "Clerc plugin help",
@@ -45,16 +45,16 @@
45
45
  "access": "public"
46
46
  },
47
47
  "dependencies": {
48
- "@types/text-table": "^0.2.5",
49
48
  "@uttr/tint": "^0.1.3",
50
49
  "string-width": "^8.1.0",
51
- "text-table": "^0.2.0"
50
+ "text-table": "^0.2.0",
51
+ "@clerc/utils": "1.0.3"
52
52
  },
53
53
  "devDependencies": {
54
+ "@types/text-table": "^0.2.5",
54
55
  "kons": "^0.7.1",
55
- "@clerc/core": "1.0.2",
56
- "@clerc/parser": "1.0.2",
57
- "@clerc/utils": "1.0.2"
56
+ "@clerc/core": "1.0.3",
57
+ "@clerc/parser": "1.0.3"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@clerc/core": "*"