@optique/man 1.4.0-dev.2676 → 1.4.0-dev.2679
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 +8 -5
- package/dist/cli.js +8 -5
- package/dist/{generator-DVBEnpDF.cjs → generator-BOnOtkJo.cjs} +2 -1
- package/dist/{generator-CavUoyIv.js → generator-DQzLiBjq.js} +2 -1
- package/dist/{generator-vn382hBl.d.cts → generator-DpK0Sjwb.d.cts} +1 -1
- package/dist/{generator-DgWHeZ4I.d.ts → generator-l5JcmLW0.d.ts} +1 -1
- package/dist/generator.cjs +2 -2
- package/dist/generator.d.cts +2 -2
- package/dist/generator.d.ts +2 -2
- package/dist/generator.js +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{man-C--dNTRq.d.cts → man-BON751gT.d.cts} +9 -1
- package/dist/{man-Dq6PNLlO.js → man-BS0Yx0Li.js} +22 -3
- package/dist/{man-BJ8K8qw-.cjs → man-BmoPyf06.cjs} +22 -3
- package/dist/{man-D1GouPZ0.d.ts → man-CwjJZCko.d.ts} +9 -1
- package/dist/man.cjs +1 -1
- package/dist/man.d.cts +1 -1
- package/dist/man.d.ts +1 -1
- package/dist/man.js +1 -1
- package/package.json +4 -4
package/dist/cli.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_man = require('./man-
|
|
2
|
+
const require_man = require('./man-BmoPyf06.cjs');
|
|
3
3
|
require('./roff-C8MvQ2tL.cjs');
|
|
4
|
-
const require_generator = require('./generator-
|
|
4
|
+
const require_generator = require('./generator-BOnOtkJo.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.4.0-dev.
|
|
20
|
+
var version = "1.4.0-dev.2679+3a3a57d2";
|
|
21
21
|
var license = "MIT";
|
|
22
22
|
var exports$1 = {
|
|
23
23
|
".": "./src/index.ts",
|
|
@@ -93,6 +93,7 @@ a ${(0, __optique_core_message.metavar)("PROGRAM")} or ${(0, __optique_core_mess
|
|
|
93
93
|
"section",
|
|
94
94
|
"both"
|
|
95
95
|
], { metavar: "LAYOUT" }), { description: __optique_core_message.message`Document declared environment bindings inline, in a section, or both.` })),
|
|
96
|
+
showAliases: (0, __optique_core_primitives.option)("--show-aliases", { description: __optique_core_message.message`Document command aliases next to their commands.` }),
|
|
96
97
|
exportName: (0, __optique_core_modifiers.withDefault)((0, __optique_core_primitives.option)("-e", "--export", (0, __optique_core_valueparser.string)({ metavar: "NAME" }), { description: __optique_core_message.message`JavaScript export name to use. The export must be
|
|
97
98
|
a ${(0, __optique_core_message.metavar)("PROGRAM")} (from ${(0, __optique_core_message.commandLine)("defineProgram()")}) or
|
|
98
99
|
a ${(0, __optique_core_message.metavar)("PARSER")}. If not specified, the default export is used.` }), "default"),
|
|
@@ -402,7 +403,8 @@ async function main() {
|
|
|
402
403
|
date,
|
|
403
404
|
version: args.versionString,
|
|
404
405
|
manual: args.manual,
|
|
405
|
-
showEnvironment: args.showEnvironment == null ? void 0 : { placement: args.showEnvironment }
|
|
406
|
+
showEnvironment: args.showEnvironment == null ? void 0 : { placement: args.showEnvironment },
|
|
407
|
+
showAliases: args.showAliases
|
|
406
408
|
});
|
|
407
409
|
else manPage = await require_generator.generateManPageAsync(target, {
|
|
408
410
|
name: name$1,
|
|
@@ -410,7 +412,8 @@ async function main() {
|
|
|
410
412
|
date,
|
|
411
413
|
version: args.versionString,
|
|
412
414
|
manual: args.manual,
|
|
413
|
-
showEnvironment: args.showEnvironment == null ? void 0 : { placement: args.showEnvironment }
|
|
415
|
+
showEnvironment: args.showEnvironment == null ? void 0 : { placement: args.showEnvironment },
|
|
416
|
+
showAliases: args.showAliases
|
|
414
417
|
});
|
|
415
418
|
} catch (error) {
|
|
416
419
|
generationError(error instanceof Error ? error : new Error(String(error)));
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "./roff-Bh9bsH6u.js";
|
|
3
|
-
import "./man-
|
|
4
|
-
import { generateManPageAsync } from "./generator-
|
|
3
|
+
import "./man-BS0Yx0Li.js";
|
|
4
|
+
import { generateManPageAsync } from "./generator-DQzLiBjq.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.4.0-dev.
|
|
20
|
+
var version = "1.4.0-dev.2679+3a3a57d2";
|
|
21
21
|
var license = "MIT";
|
|
22
22
|
var exports = {
|
|
23
23
|
".": "./src/index.ts",
|
|
@@ -93,6 +93,7 @@ a ${metavar("PROGRAM")} or ${metavar("PARSER")} to generate a man page from.` })
|
|
|
93
93
|
"section",
|
|
94
94
|
"both"
|
|
95
95
|
], { metavar: "LAYOUT" }), { description: message`Document declared environment bindings inline, in a section, or both.` })),
|
|
96
|
+
showAliases: option("--show-aliases", { description: message`Document command aliases next to their commands.` }),
|
|
96
97
|
exportName: withDefault(option("-e", "--export", string({ metavar: "NAME" }), { description: message`JavaScript export name to use. The export must be
|
|
97
98
|
a ${metavar("PROGRAM")} (from ${commandLine("defineProgram()")}) or
|
|
98
99
|
a ${metavar("PARSER")}. If not specified, the default export is used.` }), "default"),
|
|
@@ -402,7 +403,8 @@ async function main() {
|
|
|
402
403
|
date,
|
|
403
404
|
version: args.versionString,
|
|
404
405
|
manual: args.manual,
|
|
405
|
-
showEnvironment: args.showEnvironment == null ? void 0 : { placement: args.showEnvironment }
|
|
406
|
+
showEnvironment: args.showEnvironment == null ? void 0 : { placement: args.showEnvironment },
|
|
407
|
+
showAliases: args.showAliases
|
|
406
408
|
});
|
|
407
409
|
else manPage = await generateManPageAsync(target, {
|
|
408
410
|
name: name$1,
|
|
@@ -410,7 +412,8 @@ async function main() {
|
|
|
410
412
|
date,
|
|
411
413
|
version: args.versionString,
|
|
412
414
|
manual: args.manual,
|
|
413
|
-
showEnvironment: args.showEnvironment == null ? void 0 : { placement: args.showEnvironment }
|
|
415
|
+
showEnvironment: args.showEnvironment == null ? void 0 : { placement: args.showEnvironment },
|
|
416
|
+
showAliases: args.showAliases
|
|
414
417
|
});
|
|
415
418
|
} catch (error) {
|
|
416
419
|
generationError(error instanceof Error ? error : new Error(String(error)));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_man = require('./man-
|
|
1
|
+
const require_man = require('./man-BmoPyf06.cjs');
|
|
2
2
|
const __optique_core_parser = require_man.__toESM(require("@optique/core/parser"));
|
|
3
3
|
|
|
4
4
|
//#region src/generator.ts
|
|
@@ -56,6 +56,7 @@ function extractParserAndOptions(parserOrProgram, options) {
|
|
|
56
56
|
seeAlso: programOptions.seeAlso,
|
|
57
57
|
environment: programOptions.environment,
|
|
58
58
|
showEnvironment: programOptions.showEnvironment,
|
|
59
|
+
showAliases: programOptions.showAliases,
|
|
59
60
|
files: programOptions.files,
|
|
60
61
|
exitStatus: programOptions.exitStatus
|
|
61
62
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatDocPageAsMan } from "./man-
|
|
1
|
+
import { formatDocPageAsMan } from "./man-BS0Yx0Li.js";
|
|
2
2
|
import { getDocPageAsync, getDocPageSync } from "@optique/core/parser";
|
|
3
3
|
|
|
4
4
|
//#region src/generator.ts
|
|
@@ -56,6 +56,7 @@ function extractParserAndOptions(parserOrProgram, options) {
|
|
|
56
56
|
seeAlso: programOptions.seeAlso,
|
|
57
57
|
environment: programOptions.environment,
|
|
58
58
|
showEnvironment: programOptions.showEnvironment,
|
|
59
|
+
showAliases: programOptions.showAliases,
|
|
59
60
|
files: programOptions.files,
|
|
60
61
|
exitStatus: programOptions.exitStatus
|
|
61
62
|
}
|
package/dist/generator.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require('./man-
|
|
1
|
+
require('./man-BmoPyf06.cjs');
|
|
2
2
|
require('./roff-C8MvQ2tL.cjs');
|
|
3
|
-
const require_generator = require('./generator-
|
|
3
|
+
const require_generator = require('./generator-BOnOtkJo.cjs');
|
|
4
4
|
|
|
5
5
|
exports.generateManPage = require_generator.generateManPage;
|
|
6
6
|
exports.generateManPageAsync = require_generator.generateManPageAsync;
|
package/dist/generator.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./man-
|
|
2
|
-
import { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync } from "./generator-
|
|
1
|
+
import "./man-BON751gT.cjs";
|
|
2
|
+
import { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync } from "./generator-DpK0Sjwb.cjs";
|
|
3
3
|
export { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync };
|
package/dist/generator.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./man-
|
|
2
|
-
import { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync } from "./generator-
|
|
1
|
+
import "./man-CwjJZCko.js";
|
|
2
|
+
import { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync } from "./generator-l5JcmLW0.js";
|
|
3
3
|
export { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync };
|
package/dist/generator.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./roff-Bh9bsH6u.js";
|
|
2
|
-
import "./man-
|
|
3
|
-
import { generateManPage, generateManPageAsync, generateManPageSync } from "./generator-
|
|
2
|
+
import "./man-BS0Yx0Li.js";
|
|
3
|
+
import { generateManPage, generateManPageAsync, generateManPageSync } from "./generator-DQzLiBjq.js";
|
|
4
4
|
|
|
5
5
|
export { generateManPage, generateManPageAsync, generateManPageSync };
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_man = require('./man-
|
|
1
|
+
const require_man = require('./man-BmoPyf06.cjs');
|
|
2
2
|
const require_roff = require('./roff-C8MvQ2tL.cjs');
|
|
3
|
-
const require_generator = require('./generator-
|
|
3
|
+
const require_generator = require('./generator-BOnOtkJo.cjs');
|
|
4
4
|
|
|
5
5
|
exports.escapeHyphens = require_roff.escapeHyphens;
|
|
6
6
|
exports.escapeQuotedValue = require_roff.escapeQuotedValue;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ManPageOptions, formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-
|
|
2
|
-
import { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync } from "./generator-
|
|
1
|
+
import { ManPageOptions, formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-BON751gT.cjs";
|
|
2
|
+
import { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync } from "./generator-DpK0Sjwb.cjs";
|
|
3
3
|
import { RoffFormatOptions, escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatMessageAsRoff } from "./roff-Cpm_FJok.cjs";
|
|
4
4
|
export { type GenerateManPageOptions, type GenerateManPageProgramOptions, type ManPageOptions, type RoffFormatOptions, escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatDateForMan, formatDocPageAsMan, formatMessageAsRoff, formatUsageTermAsRoff, generateManPage, generateManPageAsync, generateManPageSync };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ManPageOptions, formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-
|
|
2
|
-
import { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync } from "./generator-
|
|
1
|
+
import { ManPageOptions, formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-CwjJZCko.js";
|
|
2
|
+
import { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync } from "./generator-l5JcmLW0.js";
|
|
3
3
|
import { RoffFormatOptions, escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatMessageAsRoff } from "./roff-DkJvVQ1o.js";
|
|
4
4
|
export { type GenerateManPageOptions, type GenerateManPageProgramOptions, type ManPageOptions, type RoffFormatOptions, escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatDateForMan, formatDocPageAsMan, formatMessageAsRoff, formatUsageTermAsRoff, generateManPage, generateManPageAsync, generateManPageSync };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatMessageAsRoff } from "./roff-Bh9bsH6u.js";
|
|
2
|
-
import { formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-
|
|
3
|
-
import { generateManPage, generateManPageAsync, generateManPageSync } from "./generator-
|
|
2
|
+
import { formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-BS0Yx0Li.js";
|
|
3
|
+
import { generateManPage, generateManPageAsync, generateManPageSync } from "./generator-DQzLiBjq.js";
|
|
4
4
|
|
|
5
5
|
export { escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatDateForMan, formatDocPageAsMan, formatMessageAsRoff, formatUsageTermAsRoff, generateManPage, generateManPageAsync, generateManPageSync };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocPage, DocSection, ShowEnvironmentOptions } from "@optique/core/doc";
|
|
1
|
+
import { DocPage, DocSection, ShowAliasesOptions, ShowEnvironmentOptions } from "@optique/core/doc";
|
|
2
2
|
import { Message } from "@optique/core/message";
|
|
3
3
|
import { UsageTerm } from "@optique/core/usage";
|
|
4
4
|
|
|
@@ -80,6 +80,14 @@ interface ManPageOptions {
|
|
|
80
80
|
* @since 1.4.0
|
|
81
81
|
*/
|
|
82
82
|
readonly showEnvironment?: boolean | ShowEnvironmentOptions;
|
|
83
|
+
/**
|
|
84
|
+
* Whether and how to display command aliases next to commands, e.g.,
|
|
85
|
+
* `(aliases: i, add)`. This is the fallback for entries that do not set
|
|
86
|
+
* their own `showAliases`; an entry's own setting always wins.
|
|
87
|
+
* Defaults to `false`.
|
|
88
|
+
* @since 1.4.0
|
|
89
|
+
*/
|
|
90
|
+
readonly showAliases?: boolean | ShowAliasesOptions;
|
|
83
91
|
/**
|
|
84
92
|
* File paths to document in the FILES section.
|
|
85
93
|
*/
|
|
@@ -221,12 +221,28 @@ function inferSectionTitle(entries) {
|
|
|
221
221
|
return "OPTIONS";
|
|
222
222
|
}
|
|
223
223
|
/**
|
|
224
|
+
* Builds the plain text of a command entry's alias annotation, or returns
|
|
225
|
+
* `undefined` when the entry has no aliases to show. The text is not yet
|
|
226
|
+
* escaped for roff.
|
|
227
|
+
*/
|
|
228
|
+
function formatAliasesAnnotation(entry, showAliases) {
|
|
229
|
+
if (entry.term.type !== "command") return void 0;
|
|
230
|
+
if (!(entry.showAliases ?? showAliases !== false)) return void 0;
|
|
231
|
+
const aliases = (entry.term.aliases ?? []).filter((alias) => alias !== "");
|
|
232
|
+
if (aliases.length < 1) return void 0;
|
|
233
|
+
const config = typeof showAliases === "object" ? showAliases : {};
|
|
234
|
+
return {
|
|
235
|
+
prefix: config.prefix ?? " (",
|
|
236
|
+
body: `${config.label ?? "aliases: "}${aliases.join(", ")}${config.suffix ?? ")"}`
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
224
240
|
* Formats a {@link DocSection} as roff markup with .TP macros.
|
|
225
241
|
*
|
|
226
242
|
* @param section The section to format.
|
|
227
243
|
* @returns The roff-formatted section content.
|
|
228
244
|
*/
|
|
229
|
-
function formatDocSectionEntries(section, showEnvironment = false, generatedEnvironment = false) {
|
|
245
|
+
function formatDocSectionEntries(section, showEnvironment = false, generatedEnvironment = false, showAliases = false) {
|
|
230
246
|
const lines = [];
|
|
231
247
|
for (const entry of section.entries) {
|
|
232
248
|
const termStr = formatDocEntryTerm(entry.term);
|
|
@@ -238,15 +254,18 @@ function formatDocSectionEntries(section, showEnvironment = false, generatedEnvi
|
|
|
238
254
|
type: "envVar",
|
|
239
255
|
envVar: name
|
|
240
256
|
}])).join(", ")}]`;
|
|
257
|
+
const aliases = formatAliasesAnnotation(entry, showAliases);
|
|
241
258
|
if (entry.description) {
|
|
242
259
|
let desc = formatMessageAsRoff(entry.description, generatedEnvironment ? { quotes: false } : {});
|
|
260
|
+
if (aliases != null) desc += escapeHyphens(escapeRoff(aliases.prefix + aliases.body));
|
|
243
261
|
if (entry.default) desc += ` [${formatMessageAsRoff(entry.default)}]`;
|
|
244
262
|
if (entry.choices) desc += ` (choices: ${formatMessageAsRoff(entry.choices, { quotes: false })})`;
|
|
245
263
|
const separator = desc === "" || desc.endsWith("\n") ? "" : " ";
|
|
246
264
|
const body = envAnnotation === "" ? desc : desc + separator + envAnnotation;
|
|
247
265
|
lines.push(generatedEnvironment && body === "" ? "\\&" : body);
|
|
248
|
-
} else if (entry.default || entry.choices || envAnnotation !== "") {
|
|
266
|
+
} else if (aliases != null || entry.default || entry.choices || envAnnotation !== "") {
|
|
249
267
|
const parts = [];
|
|
268
|
+
if (aliases != null) parts.push(escapeHyphens(escapeRoff(aliases.prefix.trimStart() + aliases.body)));
|
|
250
269
|
if (entry.default) parts.push(`[${formatMessageAsRoff(entry.default)}]`);
|
|
251
270
|
if (entry.choices) parts.push(`(choices: ${formatMessageAsRoff(entry.choices, { quotes: false })})`);
|
|
252
271
|
if (envAnnotation !== "") parts.push(envAnnotation);
|
|
@@ -329,7 +348,7 @@ function formatDocPageAsMan(page, options) {
|
|
|
329
348
|
const inlineEnvironment = placement === "inline" || placement === "both";
|
|
330
349
|
for (const section of page.sections) {
|
|
331
350
|
if (section.entries.length === 0) continue;
|
|
332
|
-
const content = formatDocSectionEntries(section, inlineEnvironment);
|
|
351
|
+
const content = formatDocSectionEntries(section, inlineEnvironment, false, options.showAliases ?? false);
|
|
333
352
|
if (content === "") continue;
|
|
334
353
|
const title = section.title?.toUpperCase() ?? inferSectionTitle(section.entries);
|
|
335
354
|
lines.push(`.SH "${escapeRequestArg(title)}"`);
|
|
@@ -244,12 +244,28 @@ function inferSectionTitle(entries) {
|
|
|
244
244
|
return "OPTIONS";
|
|
245
245
|
}
|
|
246
246
|
/**
|
|
247
|
+
* Builds the plain text of a command entry's alias annotation, or returns
|
|
248
|
+
* `undefined` when the entry has no aliases to show. The text is not yet
|
|
249
|
+
* escaped for roff.
|
|
250
|
+
*/
|
|
251
|
+
function formatAliasesAnnotation(entry, showAliases) {
|
|
252
|
+
if (entry.term.type !== "command") return void 0;
|
|
253
|
+
if (!(entry.showAliases ?? showAliases !== false)) return void 0;
|
|
254
|
+
const aliases = (entry.term.aliases ?? []).filter((alias) => alias !== "");
|
|
255
|
+
if (aliases.length < 1) return void 0;
|
|
256
|
+
const config = typeof showAliases === "object" ? showAliases : {};
|
|
257
|
+
return {
|
|
258
|
+
prefix: config.prefix ?? " (",
|
|
259
|
+
body: `${config.label ?? "aliases: "}${aliases.join(", ")}${config.suffix ?? ")"}`
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
247
263
|
* Formats a {@link DocSection} as roff markup with .TP macros.
|
|
248
264
|
*
|
|
249
265
|
* @param section The section to format.
|
|
250
266
|
* @returns The roff-formatted section content.
|
|
251
267
|
*/
|
|
252
|
-
function formatDocSectionEntries(section, showEnvironment = false, generatedEnvironment = false) {
|
|
268
|
+
function formatDocSectionEntries(section, showEnvironment = false, generatedEnvironment = false, showAliases = false) {
|
|
253
269
|
const lines = [];
|
|
254
270
|
for (const entry of section.entries) {
|
|
255
271
|
const termStr = formatDocEntryTerm(entry.term);
|
|
@@ -261,15 +277,18 @@ function formatDocSectionEntries(section, showEnvironment = false, generatedEnvi
|
|
|
261
277
|
type: "envVar",
|
|
262
278
|
envVar: name
|
|
263
279
|
}])).join(", ")}]`;
|
|
280
|
+
const aliases = formatAliasesAnnotation(entry, showAliases);
|
|
264
281
|
if (entry.description) {
|
|
265
282
|
let desc = require_roff.formatMessageAsRoff(entry.description, generatedEnvironment ? { quotes: false } : {});
|
|
283
|
+
if (aliases != null) desc += require_roff.escapeHyphens(require_roff.escapeRoff(aliases.prefix + aliases.body));
|
|
266
284
|
if (entry.default) desc += ` [${require_roff.formatMessageAsRoff(entry.default)}]`;
|
|
267
285
|
if (entry.choices) desc += ` (choices: ${require_roff.formatMessageAsRoff(entry.choices, { quotes: false })})`;
|
|
268
286
|
const separator = desc === "" || desc.endsWith("\n") ? "" : " ";
|
|
269
287
|
const body = envAnnotation === "" ? desc : desc + separator + envAnnotation;
|
|
270
288
|
lines.push(generatedEnvironment && body === "" ? "\\&" : body);
|
|
271
|
-
} else if (entry.default || entry.choices || envAnnotation !== "") {
|
|
289
|
+
} else if (aliases != null || entry.default || entry.choices || envAnnotation !== "") {
|
|
272
290
|
const parts = [];
|
|
291
|
+
if (aliases != null) parts.push(require_roff.escapeHyphens(require_roff.escapeRoff(aliases.prefix.trimStart() + aliases.body)));
|
|
273
292
|
if (entry.default) parts.push(`[${require_roff.formatMessageAsRoff(entry.default)}]`);
|
|
274
293
|
if (entry.choices) parts.push(`(choices: ${require_roff.formatMessageAsRoff(entry.choices, { quotes: false })})`);
|
|
275
294
|
if (envAnnotation !== "") parts.push(envAnnotation);
|
|
@@ -352,7 +371,7 @@ function formatDocPageAsMan(page, options) {
|
|
|
352
371
|
const inlineEnvironment = placement === "inline" || placement === "both";
|
|
353
372
|
for (const section of page.sections) {
|
|
354
373
|
if (section.entries.length === 0) continue;
|
|
355
|
-
const content = formatDocSectionEntries(section, inlineEnvironment);
|
|
374
|
+
const content = formatDocSectionEntries(section, inlineEnvironment, false, options.showAliases ?? false);
|
|
356
375
|
if (content === "") continue;
|
|
357
376
|
const title = section.title?.toUpperCase() ?? inferSectionTitle(section.entries);
|
|
358
377
|
lines.push(`.SH "${require_roff.escapeRequestArg(title)}"`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Message } from "@optique/core/message";
|
|
2
|
-
import { DocPage, DocSection, ShowEnvironmentOptions } from "@optique/core/doc";
|
|
2
|
+
import { DocPage, DocSection, ShowAliasesOptions, ShowEnvironmentOptions } from "@optique/core/doc";
|
|
3
3
|
import { UsageTerm } from "@optique/core/usage";
|
|
4
4
|
|
|
5
5
|
//#region src/man.d.ts
|
|
@@ -80,6 +80,14 @@ interface ManPageOptions {
|
|
|
80
80
|
* @since 1.4.0
|
|
81
81
|
*/
|
|
82
82
|
readonly showEnvironment?: boolean | ShowEnvironmentOptions;
|
|
83
|
+
/**
|
|
84
|
+
* Whether and how to display command aliases next to commands, e.g.,
|
|
85
|
+
* `(aliases: i, add)`. This is the fallback for entries that do not set
|
|
86
|
+
* their own `showAliases`; an entry's own setting always wins.
|
|
87
|
+
* Defaults to `false`.
|
|
88
|
+
* @since 1.4.0
|
|
89
|
+
*/
|
|
90
|
+
readonly showAliases?: boolean | ShowAliasesOptions;
|
|
83
91
|
/**
|
|
84
92
|
* File paths to document in the FILES section.
|
|
85
93
|
*/
|
package/dist/man.cjs
CHANGED
package/dist/man.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ManPageOptions, ManPageSection, formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-
|
|
1
|
+
import { ManPageOptions, ManPageSection, formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-BON751gT.cjs";
|
|
2
2
|
export { ManPageOptions, ManPageSection, formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff };
|
package/dist/man.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ManPageOptions, ManPageSection, formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-
|
|
1
|
+
import { ManPageOptions, ManPageSection, formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-CwjJZCko.js";
|
|
2
2
|
export { ManPageOptions, ManPageSection, formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff };
|
package/dist/man.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "./roff-Bh9bsH6u.js";
|
|
2
|
-
import { formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-
|
|
2
|
+
import { formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-BS0Yx0Li.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.4.0-dev.
|
|
3
|
+
"version": "1.4.0-dev.2679",
|
|
4
4
|
"description": "Man page generator for Optique CLI parsers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
"optique-man": "./dist/cli.js"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@optique/core": "1.4.0-dev.
|
|
94
|
-
"@optique/run": "1.4.0-dev.
|
|
93
|
+
"@optique/core": "1.4.0-dev.2679+3a3a57d2",
|
|
94
|
+
"@optique/run": "1.4.0-dev.2679+3a3a57d2"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@optique/testing": "1.4.0-dev.
|
|
97
|
+
"@optique/testing": "1.4.0-dev.2679+3a3a57d2",
|
|
98
98
|
"@types/node": "^24.0.0",
|
|
99
99
|
"tsdown": "^0.13.0",
|
|
100
100
|
"tsx": "^4.21.0",
|