@virmator/help 14.32.1 → 14.34.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.
@@ -1,11 +1,19 @@
1
1
  import { type PartialWithUndefined } from '@augment-vir/common';
2
2
  import { type VirmatorPlugin, type VirmatorPluginCliCommands } from '@virmator/core';
3
- /** Different syntaxes for each supported help message target environment. */
3
+ /**
4
+ * Different syntaxes for each supported help message target environment.
5
+ *
6
+ * @category Util
7
+ */
4
8
  export declare enum HelpMessageSyntax {
5
9
  Cli = "cli",
6
10
  Markdown = "markdown"
7
11
  }
8
- /** Inputs for {@link generateHelpMessageFromPlugins}. */
12
+ /**
13
+ * Inputs for {@link generateHelpMessageFromPlugins}.
14
+ *
15
+ * @category Util
16
+ */
9
17
  export type GenerateHelpMessageFromPluginsParams = {
10
18
  plugins: ReadonlyArray<Readonly<Pick<VirmatorPlugin, 'cliCommands'>>>;
11
19
  syntax: HelpMessageSyntax;
@@ -13,9 +21,17 @@ export type GenerateHelpMessageFromPluginsParams = {
13
21
  hideVirmatorExplanations: boolean;
14
22
  cliWrapIfMoreThanThisManyColumns: number;
15
23
  }>;
16
- /** Generate a help message from a list of `VirmatorPlugin` instances. */
24
+ /**
25
+ * Generate a help message from a list of `VirmatorPlugin` instances.
26
+ *
27
+ * @category Util
28
+ */
17
29
  export declare function generateHelpMessageFromPlugins({ plugins, syntax, hideVirmatorExplanations, cliWrapIfMoreThanThisManyColumns, }: Readonly<GenerateHelpMessageFromPluginsParams>): string;
18
- /** Inputs for {@link generateHelpMessage}. */
30
+ /**
31
+ * Inputs for {@link generateHelpMessage}.
32
+ *
33
+ * @category Util
34
+ */
19
35
  export type GenerateHelpMessageParams = {
20
36
  cliCommands: ReadonlyArray<Readonly<VirmatorPluginCliCommands>>;
21
37
  syntax: HelpMessageSyntax;
@@ -26,9 +42,15 @@ export type GenerateHelpMessageParams = {
26
42
  /**
27
43
  * Generate a help message directly from `VirmatorPluginCliCommands`. Used by
28
44
  * {@link generateHelpMessageFromPlugins}.
45
+ *
46
+ * @category Util
29
47
  */
30
48
  export declare function generateHelpMessage({ cliCommands, syntax, hideVirmatorExplanations, cliWrapIfMoreThanThisManyColumns, }: Readonly<GenerateHelpMessageParams>): string;
31
- /** All supported formats for help messages. */
49
+ /**
50
+ * All supported formats for help messages.
51
+ *
52
+ * @category Util
53
+ */
32
54
  export declare const formats: {
33
55
  readonly h1: {
34
56
  readonly cli: string;
@@ -71,9 +93,21 @@ export declare const formats: {
71
93
  readonly markdown: "\\";
72
94
  };
73
95
  };
74
- /** Help message formatter. */
96
+ /**
97
+ * Help message formatter.
98
+ *
99
+ * @category Util
100
+ */
75
101
  export type Formatter = Record<keyof typeof formats, string>;
76
- /** Create a help message formatter based on a specific syntax. */
102
+ /**
103
+ * Create a help message formatter based on a specific syntax.
104
+ *
105
+ * @category Util
106
+ */
77
107
  export declare function createFormatter(syntax: HelpMessageSyntax): Formatter;
78
- /** Wrap lines to within the specified limit. */
108
+ /**
109
+ * Wrap lines to within the specified limit.
110
+ *
111
+ * @category Util
112
+ */
79
113
  export declare function wrapLines(input: string, limit: number, format: Formatter): string;
@@ -2,7 +2,11 @@ import { check } from '@augment-vir/assert';
2
2
  import { collapseWhiteSpace, getObjectTypedEntries, logColors, mapObjectValues, safeMatch, } from '@augment-vir/common';
3
3
  import { toPosixPath } from '@augment-vir/node';
4
4
  import { virmatorFlags, } from '@virmator/core';
5
- /** Different syntaxes for each supported help message target environment. */
5
+ /**
6
+ * Different syntaxes for each supported help message target environment.
7
+ *
8
+ * @category Util
9
+ */
6
10
  export var HelpMessageSyntax;
7
11
  (function (HelpMessageSyntax) {
8
12
  HelpMessageSyntax["Cli"] = "cli";
@@ -14,7 +18,11 @@ function flattenCommands(cliCommands) {
14
18
  return accum;
15
19
  }, {});
16
20
  }
17
- /** Generate a help message from a list of `VirmatorPlugin` instances. */
21
+ /**
22
+ * Generate a help message from a list of `VirmatorPlugin` instances.
23
+ *
24
+ * @category Util
25
+ */
18
26
  export function generateHelpMessageFromPlugins({ plugins, syntax, hideVirmatorExplanations = false, cliWrapIfMoreThanThisManyColumns = 100, }) {
19
27
  return generateHelpMessage({
20
28
  cliCommands: plugins.map((plugin) => plugin.cliCommands),
@@ -26,6 +34,8 @@ export function generateHelpMessageFromPlugins({ plugins, syntax, hideVirmatorEx
26
34
  /**
27
35
  * Generate a help message directly from `VirmatorPluginCliCommands`. Used by
28
36
  * {@link generateHelpMessageFromPlugins}.
37
+ *
38
+ * @category Util
29
39
  */
30
40
  export function generateHelpMessage({ cliCommands, syntax, hideVirmatorExplanations = false, cliWrapIfMoreThanThisManyColumns = 100, }) {
31
41
  const allCommands = flattenCommands(cliCommands);
@@ -51,7 +61,11 @@ export function generateHelpMessage({ cliCommands, syntax, hideVirmatorExplanati
51
61
  ? wrapLines(helpMessage, cliWrapIfMoreThanThisManyColumns, format)
52
62
  : helpMessage;
53
63
  }
54
- /** All supported formats for help messages. */
64
+ /**
65
+ * All supported formats for help messages.
66
+ *
67
+ * @category Util
68
+ */
55
69
  export const formats = {
56
70
  h1: {
57
71
  [HelpMessageSyntax.Cli]: logColors.info,
@@ -94,7 +108,11 @@ export const formats = {
94
108
  [HelpMessageSyntax.Markdown]: '\\',
95
109
  },
96
110
  };
97
- /** Create a help message formatter based on a specific syntax. */
111
+ /**
112
+ * Create a help message formatter based on a specific syntax.
113
+ *
114
+ * @category Util
115
+ */
98
116
  export function createFormatter(syntax) {
99
117
  return mapObjectValues(formats, (key, entry) => {
100
118
  return entry[syntax];
@@ -204,7 +222,11 @@ function getIndent(line, format) {
204
222
  startsWithBullet ? ' '.repeat(format.bullet.length) : '',
205
223
  ].join('');
206
224
  }
207
- /** Wrap lines to within the specified limit. */
225
+ /**
226
+ * Wrap lines to within the specified limit.
227
+ *
228
+ * @category Util
229
+ */
208
230
  export function wrapLines(input, limit, format) {
209
231
  const lines = input.split('\n');
210
232
  // using a for loop because the length of the array will get modified while iterating through it
package/dist/help.d.ts CHANGED
@@ -1,4 +1,8 @@
1
- /** A virmator plugin for printing help messages from other plugins. */
1
+ /**
2
+ * A virmator plugin for printing help messages from other plugins.
3
+ *
4
+ * @category Main
5
+ */
2
6
  export declare const virmatorHelpPlugin: Readonly<Readonly<{
3
7
  name: string;
4
8
  cliCommands: NoInfer<{
package/dist/help.js CHANGED
@@ -1,6 +1,10 @@
1
1
  import { defineVirmatorPlugin } from '@virmator/core';
2
2
  import { generateHelpMessageFromPlugins, HelpMessageSyntax } from './help-message.js';
3
- /** A virmator plugin for printing help messages from other plugins. */
3
+ /**
4
+ * A virmator plugin for printing help messages from other plugins.
5
+ *
6
+ * @category Main
7
+ */
4
8
  export const virmatorHelpPlugin = defineVirmatorPlugin(import.meta.dirname, {
5
9
  name: 'Help',
6
10
  cliCommands: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virmator/help",
3
- "version": "14.32.1",
3
+ "version": "14.34.0",
4
4
  "description": "Default help plugin for virmator.",
5
5
  "keywords": [
6
6
  "virmator",
@@ -32,14 +32,14 @@
32
32
  "test:update": "npm test update"
33
33
  },
34
34
  "dependencies": {
35
- "@augment-vir/assert": "^32.2.3",
36
- "@augment-vir/common": "^32.2.3",
37
- "@augment-vir/node": "^32.2.3",
38
- "@virmator/core": "^14.32.1"
35
+ "@augment-vir/assert": "^32.2.4",
36
+ "@augment-vir/common": "^32.2.4",
37
+ "@augment-vir/node": "^32.2.4",
38
+ "@virmator/core": "^14.34.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@augment-vir/test": "^32.2.3",
42
- "@types/node": "^26.2.0",
41
+ "@augment-vir/test": "^32.2.4",
42
+ "@types/node": "^26.4.0",
43
43
  "c8": "^12.0.0",
44
44
  "istanbul-smart-text-reporter": "^1.1.5"
45
45
  },