@optique/man 1.0.0-dev.783 → 1.0.0-dev.788

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/cli.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const require_man = require('./man-CT30XV48.cjs');
2
+ const require_man = require('./man-j-bcfLoE.cjs');
3
3
  require('./roff-EpcecLXU.cjs');
4
- const require_generator = require('./generator-BDKtMiuq.cjs');
4
+ const require_generator = require('./generator-CuGGdQoF.cjs');
5
5
  const __optique_core_constructs = require_man.__toESM(require("@optique/core/constructs"));
6
6
  const __optique_core_primitives = require_man.__toESM(require("@optique/core/primitives"));
7
7
  const __optique_core_valueparser = require_man.__toESM(require("@optique/core/valueparser"));
@@ -17,7 +17,7 @@ const node_url = require_man.__toESM(require("node:url"));
17
17
 
18
18
  //#region deno.json
19
19
  var name = "@optique/man";
20
- var version = "1.0.0-dev.783+64de3665";
20
+ var version = "1.0.0-dev.788+1f1c275f";
21
21
  var license = "MIT";
22
22
  var exports$1 = {
23
23
  ".": "./src/index.ts",
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import "./roff-C_MiRXVS.js";
3
- import "./man-CAYHrsaf.js";
4
- import { generateManPageAsync } from "./generator-DGiXLyTu.js";
3
+ import "./man-DOn-s45r.js";
4
+ import { generateManPageAsync } from "./generator-kHG20XUT.js";
5
5
  import { object } from "@optique/core/constructs";
6
6
  import { argument, option } from "@optique/core/primitives";
7
7
  import { choice, string } from "@optique/core/valueparser";
@@ -17,7 +17,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
17
17
 
18
18
  //#region deno.json
19
19
  var name = "@optique/man";
20
- var version = "1.0.0-dev.783+64de3665";
20
+ var version = "1.0.0-dev.788+1f1c275f";
21
21
  var license = "MIT";
22
22
  var exports = {
23
23
  ".": "./src/index.ts",
@@ -1,4 +1,4 @@
1
- const require_man = require('./man-CT30XV48.cjs');
1
+ const require_man = require('./man-j-bcfLoE.cjs');
2
2
  const __optique_core_parser = require_man.__toESM(require("@optique/core/parser"));
3
3
 
4
4
  //#region src/generator.ts
@@ -1,4 +1,4 @@
1
- import { formatDocPageAsMan } from "./man-CAYHrsaf.js";
1
+ import { formatDocPageAsMan } from "./man-DOn-s45r.js";
2
2
  import { getDocPageAsync, getDocPageSync } from "@optique/core/parser";
3
3
 
4
4
  //#region src/generator.ts
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
- const require_man = require('./man-CT30XV48.cjs');
1
+ const require_man = require('./man-j-bcfLoE.cjs');
2
2
  const require_roff = require('./roff-EpcecLXU.cjs');
3
- const require_generator = require('./generator-BDKtMiuq.cjs');
3
+ const require_generator = require('./generator-CuGGdQoF.cjs');
4
4
 
5
5
  exports.escapeHyphens = require_roff.escapeHyphens;
6
6
  exports.escapeRoff = require_roff.escapeRoff;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { escapeHyphens, escapeRoff, formatMessageAsRoff } from "./roff-C_MiRXVS.js";
2
- import { formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-CAYHrsaf.js";
3
- import { generateManPage, generateManPageAsync, generateManPageSync } from "./generator-DGiXLyTu.js";
2
+ import { formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-DOn-s45r.js";
3
+ import { generateManPage, generateManPageAsync, generateManPageSync } from "./generator-kHG20XUT.js";
4
4
 
5
5
  export { escapeHyphens, escapeRoff, formatDateForMan, formatDocPageAsMan, formatMessageAsRoff, formatUsageTermAsRoff, generateManPage, generateManPageAsync, generateManPageSync };
@@ -1,4 +1,4 @@
1
- import { escapeHyphens, formatMessageAsRoff } from "./roff-C_MiRXVS.js";
1
+ import { escapeHyphens, escapeRoff, formatMessageAsRoff } from "./roff-C_MiRXVS.js";
2
2
  import { isDocHidden, isUsageHidden } from "@optique/core/usage";
3
3
 
4
4
  //#region src/man.ts
@@ -31,6 +31,9 @@ function formatDateForMan(date) {
31
31
  function escapeThField(value) {
32
32
  return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
33
33
  }
34
+ function formatCommandNameAsRoff(name) {
35
+ return `\\fB${escapeHyphens(escapeRoff(name))}\\fR`;
36
+ }
34
37
  /**
35
38
  * Formats a single {@link UsageTerm} as roff markup for the SYNOPSIS section.
36
39
  *
@@ -48,7 +51,7 @@ function formatUsageTermAsRoff(term) {
48
51
  const metavarPart = term.metavar ? ` \\fI${term.metavar}\\fR` : "";
49
52
  return `[${names}${metavarPart}]`;
50
53
  }
51
- case "command": return `\\fB${term.name}\\fR`;
54
+ case "command": return formatCommandNameAsRoff(term.name);
52
55
  case "optional": {
53
56
  const inner = formatUsageAsRoff(term.terms);
54
57
  if (inner === "") return "";
@@ -98,7 +101,7 @@ function formatDocEntryTerm(term) {
98
101
  const metavarPart = term.metavar ? ` \\fI${term.metavar}\\fR` : "";
99
102
  return `${names}${metavarPart}`;
100
103
  }
101
- case "command": return `\\fB${term.name}\\fR`;
104
+ case "command": return formatCommandNameAsRoff(term.name);
102
105
  case "argument": return `\\fI${term.metavar}\\fR`;
103
106
  case "literal": return term.value;
104
107
  default: return formatDocUsageTermAsRoff(term);
@@ -136,7 +139,7 @@ function formatDocUsageTermAsRoff(term) {
136
139
  const metavarPart = term.metavar ? ` \\fI${term.metavar}\\fR` : "";
137
140
  return `${names}${metavarPart}`;
138
141
  }
139
- case "command": return `\\fB${term.name}\\fR`;
142
+ case "command": return formatCommandNameAsRoff(term.name);
140
143
  case "literal": return term.value;
141
144
  case "passthrough": return "[...]";
142
145
  case "ellipsis": return "...";
@@ -205,22 +208,22 @@ function formatDocSectionEntries(section) {
205
208
  */
206
209
  function formatDocPageAsMan(page, options) {
207
210
  const lines = [];
208
- const thParts = [escapeThField(options.name.toUpperCase()), options.section.toString()];
211
+ const thParts = [escapeHyphens(escapeThField(options.name).toUpperCase()), options.section.toString()];
209
212
  const hasDate = options.date != null;
210
213
  const hasVersion = options.version != null;
211
214
  const hasManual = options.manual != null;
212
215
  if (hasDate) thParts.push(`"${escapeThField(formatDateForMan(options.date))}"`);
213
216
  else if (hasVersion || hasManual) thParts.push("\"\"");
214
- if (hasVersion) thParts.push(`"${escapeThField(`${options.name} ${options.version}`)}"`);
217
+ if (hasVersion) thParts.push(`"${escapeHyphens(escapeThField(options.name))} ${escapeThField(options.version)}"`);
215
218
  else if (hasManual) thParts.push("\"\"");
216
219
  if (hasManual) thParts.push(`"${escapeThField(options.manual)}"`);
217
220
  lines.push(`.TH ${thParts.join(" ")}`);
218
221
  lines.push(".SH NAME");
219
- if (page.brief) lines.push(`${options.name} \\- ${formatMessageAsRoff(page.brief)}`);
220
- else lines.push(options.name);
222
+ if (page.brief) lines.push(`${escapeHyphens(escapeRoff(options.name))} \\- ${formatMessageAsRoff(page.brief)}`);
223
+ else lines.push(escapeHyphens(escapeRoff(options.name)));
221
224
  if (page.usage) {
222
225
  lines.push(".SH SYNOPSIS");
223
- lines.push(`.B ${options.name}`);
226
+ lines.push(`.B ${escapeHyphens(escapeRoff(options.name))}`);
224
227
  const usageStr = formatUsageAsRoff(page.usage);
225
228
  if (usageStr) lines.push(usageStr);
226
229
  }
@@ -269,7 +272,7 @@ function formatDocPageAsMan(page, options) {
269
272
  lines.push(".SH SEE ALSO");
270
273
  const refs = options.seeAlso.map((ref, i) => {
271
274
  const suffix = i < options.seeAlso.length - 1 ? "," : "";
272
- return `.BR ${ref.name} (${ref.section})${suffix}`;
275
+ return `.BR ${escapeHyphens(escapeRoff(ref.name))} (${ref.section})${suffix}`;
273
276
  });
274
277
  lines.push(refs.join("\n"));
275
278
  }
@@ -54,6 +54,9 @@ function formatDateForMan(date) {
54
54
  function escapeThField(value) {
55
55
  return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
56
56
  }
57
+ function formatCommandNameAsRoff(name) {
58
+ return `\\fB${require_roff.escapeHyphens(require_roff.escapeRoff(name))}\\fR`;
59
+ }
57
60
  /**
58
61
  * Formats a single {@link UsageTerm} as roff markup for the SYNOPSIS section.
59
62
  *
@@ -71,7 +74,7 @@ function formatUsageTermAsRoff(term) {
71
74
  const metavarPart = term.metavar ? ` \\fI${term.metavar}\\fR` : "";
72
75
  return `[${names}${metavarPart}]`;
73
76
  }
74
- case "command": return `\\fB${term.name}\\fR`;
77
+ case "command": return formatCommandNameAsRoff(term.name);
75
78
  case "optional": {
76
79
  const inner = formatUsageAsRoff(term.terms);
77
80
  if (inner === "") return "";
@@ -121,7 +124,7 @@ function formatDocEntryTerm(term) {
121
124
  const metavarPart = term.metavar ? ` \\fI${term.metavar}\\fR` : "";
122
125
  return `${names}${metavarPart}`;
123
126
  }
124
- case "command": return `\\fB${term.name}\\fR`;
127
+ case "command": return formatCommandNameAsRoff(term.name);
125
128
  case "argument": return `\\fI${term.metavar}\\fR`;
126
129
  case "literal": return term.value;
127
130
  default: return formatDocUsageTermAsRoff(term);
@@ -159,7 +162,7 @@ function formatDocUsageTermAsRoff(term) {
159
162
  const metavarPart = term.metavar ? ` \\fI${term.metavar}\\fR` : "";
160
163
  return `${names}${metavarPart}`;
161
164
  }
162
- case "command": return `\\fB${term.name}\\fR`;
165
+ case "command": return formatCommandNameAsRoff(term.name);
163
166
  case "literal": return term.value;
164
167
  case "passthrough": return "[...]";
165
168
  case "ellipsis": return "...";
@@ -228,22 +231,22 @@ function formatDocSectionEntries(section) {
228
231
  */
229
232
  function formatDocPageAsMan(page, options) {
230
233
  const lines = [];
231
- const thParts = [escapeThField(options.name.toUpperCase()), options.section.toString()];
234
+ const thParts = [require_roff.escapeHyphens(escapeThField(options.name).toUpperCase()), options.section.toString()];
232
235
  const hasDate = options.date != null;
233
236
  const hasVersion = options.version != null;
234
237
  const hasManual = options.manual != null;
235
238
  if (hasDate) thParts.push(`"${escapeThField(formatDateForMan(options.date))}"`);
236
239
  else if (hasVersion || hasManual) thParts.push("\"\"");
237
- if (hasVersion) thParts.push(`"${escapeThField(`${options.name} ${options.version}`)}"`);
240
+ if (hasVersion) thParts.push(`"${require_roff.escapeHyphens(escapeThField(options.name))} ${escapeThField(options.version)}"`);
238
241
  else if (hasManual) thParts.push("\"\"");
239
242
  if (hasManual) thParts.push(`"${escapeThField(options.manual)}"`);
240
243
  lines.push(`.TH ${thParts.join(" ")}`);
241
244
  lines.push(".SH NAME");
242
- if (page.brief) lines.push(`${options.name} \\- ${require_roff.formatMessageAsRoff(page.brief)}`);
243
- else lines.push(options.name);
245
+ if (page.brief) lines.push(`${require_roff.escapeHyphens(require_roff.escapeRoff(options.name))} \\- ${require_roff.formatMessageAsRoff(page.brief)}`);
246
+ else lines.push(require_roff.escapeHyphens(require_roff.escapeRoff(options.name)));
244
247
  if (page.usage) {
245
248
  lines.push(".SH SYNOPSIS");
246
- lines.push(`.B ${options.name}`);
249
+ lines.push(`.B ${require_roff.escapeHyphens(require_roff.escapeRoff(options.name))}`);
247
250
  const usageStr = formatUsageAsRoff(page.usage);
248
251
  if (usageStr) lines.push(usageStr);
249
252
  }
@@ -292,7 +295,7 @@ function formatDocPageAsMan(page, options) {
292
295
  lines.push(".SH SEE ALSO");
293
296
  const refs = options.seeAlso.map((ref, i) => {
294
297
  const suffix = i < options.seeAlso.length - 1 ? "," : "";
295
- return `.BR ${ref.name} (${ref.section})${suffix}`;
298
+ return `.BR ${require_roff.escapeHyphens(require_roff.escapeRoff(ref.name))} (${ref.section})${suffix}`;
296
299
  });
297
300
  lines.push(refs.join("\n"));
298
301
  }
package/dist/man.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_man = require('./man-CT30XV48.cjs');
1
+ const require_man = require('./man-j-bcfLoE.cjs');
2
2
  require('./roff-EpcecLXU.cjs');
3
3
 
4
4
  exports.formatDateForMan = require_man.formatDateForMan;
package/dist/man.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import "./roff-C_MiRXVS.js";
2
- import { formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-CAYHrsaf.js";
2
+ import { formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-DOn-s45r.js";
3
3
 
4
4
  export { formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/man",
3
- "version": "1.0.0-dev.783+64de3665",
3
+ "version": "1.0.0-dev.788+1f1c275f",
4
4
  "description": "Man page generator for Optique CLI parsers",
5
5
  "keywords": [
6
6
  "CLI",
@@ -84,8 +84,8 @@
84
84
  "optique-man": "./dist/cli.js"
85
85
  },
86
86
  "dependencies": {
87
- "@optique/core": "1.0.0-dev.783+64de3665",
88
- "@optique/run": "1.0.0-dev.783+64de3665"
87
+ "@optique/core": "1.0.0-dev.788+1f1c275f",
88
+ "@optique/run": "1.0.0-dev.788+1f1c275f"
89
89
  },
90
90
  "devDependencies": {
91
91
  "@types/node": "^20.19.9",