@optique/man 1.1.0-dev.2087 → 1.1.0-dev.2146
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-BghOXbM1.cjs → generator-CtkCu_MS.cjs} +1 -1
- package/dist/{generator-BJVNKvfi.js → generator-DywTJCMH.js} +1 -1
- package/dist/generator-I9cXlw1Z.d.cts +161 -0
- package/dist/generator-MbR1I1SH.d.ts +161 -0
- package/dist/generator.cjs +7 -0
- package/dist/generator.d.cts +3 -0
- package/dist/generator.d.ts +3 -0
- package/dist/generator.js +5 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -161
- package/dist/index.d.ts +3 -161
- package/dist/index.js +2 -2
- package/dist/{man-D0niZIHu.d.cts → man-C3FUTPuQ.d.cts} +1 -1
- package/dist/{man-DUUDcHjN.cjs → man-C44Q4VSc.cjs} +2 -0
- package/dist/{man-KbkR3auV.js → man-Cq0qfXg0.js} +2 -0
- 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/dist/roff.d.cts +1 -1
- package/dist/roff.d.ts +1 -1
- package/package.json +11 -5
- /package/dist/{man-C4QCIEKf.d.ts → man-CHYiSoI_.d.ts} +0 -0
- /package/dist/{roff-BbJgRI8t.d.ts → roff-Cpm_FJok.d.cts} +0 -0
- /package/dist/{roff-Cc-M-Skg.d.cts → roff-DkJvVQ1o.d.ts} +0 -0
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-C44Q4VSc.cjs');
|
|
3
3
|
require('./roff-C8MvQ2tL.cjs');
|
|
4
|
-
const require_generator = require('./generator-
|
|
4
|
+
const require_generator = require('./generator-CtkCu_MS.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.1.0-dev.
|
|
20
|
+
var version = "1.1.0-dev.2146+5fd0a75e";
|
|
21
21
|
var license = "MIT";
|
|
22
22
|
var exports$1 = {
|
|
23
23
|
".": "./src/index.ts",
|
|
@@ -25,14 +25,17 @@ var exports$1 = {
|
|
|
25
25
|
"./man": "./src/man.ts",
|
|
26
26
|
"./cli": "./src/cli.ts"
|
|
27
27
|
};
|
|
28
|
-
var imports = {
|
|
28
|
+
var imports = {
|
|
29
|
+
"#src/": "./src/",
|
|
30
|
+
"tsx/esm/api": "npm:tsx@^4.21.0/esm/api"
|
|
31
|
+
};
|
|
29
32
|
var exclude = ["dist/", "tsdown.config.ts"];
|
|
30
33
|
var tasks = {
|
|
31
34
|
"build": "pnpm build",
|
|
32
35
|
"test": "deno test",
|
|
33
36
|
"test:node": {
|
|
34
37
|
"dependencies": ["build"],
|
|
35
|
-
"command": "node --
|
|
38
|
+
"command": "node --test"
|
|
36
39
|
},
|
|
37
40
|
"test:bun": {
|
|
38
41
|
"dependencies": ["build"],
|
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-Cq0qfXg0.js";
|
|
4
|
+
import { generateManPageAsync } from "./generator-DywTJCMH.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.1.0-dev.
|
|
20
|
+
var version = "1.1.0-dev.2146+5fd0a75e";
|
|
21
21
|
var license = "MIT";
|
|
22
22
|
var exports = {
|
|
23
23
|
".": "./src/index.ts",
|
|
@@ -25,14 +25,17 @@ var exports = {
|
|
|
25
25
|
"./man": "./src/man.ts",
|
|
26
26
|
"./cli": "./src/cli.ts"
|
|
27
27
|
};
|
|
28
|
-
var imports = {
|
|
28
|
+
var imports = {
|
|
29
|
+
"#src/": "./src/",
|
|
30
|
+
"tsx/esm/api": "npm:tsx@^4.21.0/esm/api"
|
|
31
|
+
};
|
|
29
32
|
var exclude = ["dist/", "tsdown.config.ts"];
|
|
30
33
|
var tasks = {
|
|
31
34
|
"build": "pnpm build",
|
|
32
35
|
"test": "deno test",
|
|
33
36
|
"test:node": {
|
|
34
37
|
"dependencies": ["build"],
|
|
35
|
-
"command": "node --
|
|
38
|
+
"command": "node --test"
|
|
36
39
|
},
|
|
37
40
|
"test:bun": {
|
|
38
41
|
"dependencies": ["build"],
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { ManPageOptions } from "./man-C3FUTPuQ.cjs";
|
|
2
|
+
import { Mode, ModeValue, Parser } from "@optique/core/parser";
|
|
3
|
+
import { Program } from "@optique/core/program";
|
|
4
|
+
|
|
5
|
+
//#region src/generator.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Options for generating a man page from a parser.
|
|
9
|
+
* Extends {@link ManPageOptions} with the same configuration.
|
|
10
|
+
* @since 0.10.0
|
|
11
|
+
*/
|
|
12
|
+
interface GenerateManPageOptions extends ManPageOptions {}
|
|
13
|
+
/**
|
|
14
|
+
* Options for generating a man page from a {@link Program}.
|
|
15
|
+
*
|
|
16
|
+
* For Program inputs, `name`, `version`, `author`, `bugs`, `examples`,
|
|
17
|
+
* `brief`, `description`, and `footer` default to values from
|
|
18
|
+
* `program.metadata`.
|
|
19
|
+
* These fields are optional here and may be provided to override metadata.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.10.0
|
|
22
|
+
*/
|
|
23
|
+
interface GenerateManPageProgramOptions extends Partial<Omit<ManPageOptions, "section">>, Pick<ManPageOptions, "section"> {}
|
|
24
|
+
/**
|
|
25
|
+
* Generates a man page from a parser synchronously.
|
|
26
|
+
*
|
|
27
|
+
* This function extracts documentation from the parser's structure
|
|
28
|
+
* and formats it as a complete man page in roff format.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* import { generateManPageSync } from "@optique/man";
|
|
33
|
+
* import { object, option, flag } from "@optique/core/primitives";
|
|
34
|
+
* import { string } from "@optique/core/valueparser";
|
|
35
|
+
*
|
|
36
|
+
* const parser = object({
|
|
37
|
+
* verbose: flag("-v", "--verbose"),
|
|
38
|
+
* config: option("-c", "--config", string()),
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* const manPage = generateManPageSync(parser, {
|
|
42
|
+
* name: "myapp",
|
|
43
|
+
* section: 1,
|
|
44
|
+
* version: "1.0.0",
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* console.log(manPage);
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @param parserOrProgram The parser or program to generate documentation from.
|
|
51
|
+
* @param options The man page generation options.
|
|
52
|
+
* @returns The complete man page in roff format.
|
|
53
|
+
* @throws {TypeError} If the input is not a valid Parser or Program.
|
|
54
|
+
* @since 0.10.0
|
|
55
|
+
*/
|
|
56
|
+
declare function generateManPageSync<T>(program: Program<"sync", T>, options: GenerateManPageProgramOptions): string;
|
|
57
|
+
declare function generateManPageSync(parser: Parser<"sync", unknown, unknown>, options: GenerateManPageOptions): string;
|
|
58
|
+
/**
|
|
59
|
+
* Generates a man page from a parser asynchronously.
|
|
60
|
+
*
|
|
61
|
+
* This function extracts documentation from the parser's structure
|
|
62
|
+
* and formats it as a complete man page in roff format. It supports
|
|
63
|
+
* both sync and async parsers.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { generateManPageAsync } from "@optique/man";
|
|
68
|
+
* import { object, option } from "@optique/core/primitives";
|
|
69
|
+
* import { string } from "@optique/core/valueparser";
|
|
70
|
+
*
|
|
71
|
+
* const parser = object({
|
|
72
|
+
* config: option("-c", "--config", string()),
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* const manPage = await generateManPageAsync(parser, {
|
|
76
|
+
* name: "myapp",
|
|
77
|
+
* section: 1,
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @param parserOrProgram The parser or program to generate documentation from.
|
|
82
|
+
* @param options The man page generation options.
|
|
83
|
+
* @returns A promise that resolves to the complete man page in roff format.
|
|
84
|
+
* @throws {TypeError} If the input is not a valid Parser or Program.
|
|
85
|
+
* @since 0.10.0
|
|
86
|
+
*/
|
|
87
|
+
declare function generateManPageAsync<M extends Mode, T>(program: Program<M, T>, options: GenerateManPageProgramOptions): Promise<string>;
|
|
88
|
+
declare function generateManPageAsync<M extends Mode>(parser: Parser<M, unknown, unknown>, options: GenerateManPageOptions): Promise<string>;
|
|
89
|
+
/**
|
|
90
|
+
* Generates a man page from a parser or program.
|
|
91
|
+
*
|
|
92
|
+
* This function extracts documentation from the parser's structure
|
|
93
|
+
* and formats it as a complete man page in roff format.
|
|
94
|
+
*
|
|
95
|
+
* For sync parsers, it returns the man page directly.
|
|
96
|
+
* For async parsers, it returns a Promise that resolves to the man page.
|
|
97
|
+
*
|
|
98
|
+
* @example Parser-based API
|
|
99
|
+
* ```typescript
|
|
100
|
+
* import { generateManPage } from "@optique/man";
|
|
101
|
+
* import { object, option, flag } from "@optique/core/primitives";
|
|
102
|
+
* import { string, integer } from "@optique/core/valueparser";
|
|
103
|
+
* import { message } from "@optique/core/message";
|
|
104
|
+
*
|
|
105
|
+
* const parser = object({
|
|
106
|
+
* verbose: flag("-v", "--verbose", {
|
|
107
|
+
* description: message`Enable verbose output.`,
|
|
108
|
+
* }),
|
|
109
|
+
* port: option("-p", "--port", integer(), {
|
|
110
|
+
* description: message`Port to listen on.`,
|
|
111
|
+
* }),
|
|
112
|
+
* });
|
|
113
|
+
*
|
|
114
|
+
* const manPage = generateManPage(parser, {
|
|
115
|
+
* name: "myapp",
|
|
116
|
+
* section: 1,
|
|
117
|
+
* version: "1.0.0",
|
|
118
|
+
* date: new Date(),
|
|
119
|
+
* author: message`Hong Minhee`,
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
122
|
+
* // Write to file
|
|
123
|
+
* import { writeFileSync } from "node:fs";
|
|
124
|
+
* writeFileSync("myapp.1", manPage);
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @example Program-based API
|
|
128
|
+
* ```typescript
|
|
129
|
+
* import { generateManPage } from "@optique/man";
|
|
130
|
+
* import { defineProgram } from "@optique/core/program";
|
|
131
|
+
* import { object, flag } from "@optique/core/primitives";
|
|
132
|
+
* import { message } from "@optique/core/message";
|
|
133
|
+
*
|
|
134
|
+
* const prog = defineProgram({
|
|
135
|
+
* parser: object({
|
|
136
|
+
* verbose: flag("-v", "--verbose"),
|
|
137
|
+
* }),
|
|
138
|
+
* metadata: {
|
|
139
|
+
* name: "myapp",
|
|
140
|
+
* version: "1.0.0",
|
|
141
|
+
* author: message`Hong Minhee`,
|
|
142
|
+
* },
|
|
143
|
+
* });
|
|
144
|
+
*
|
|
145
|
+
* // Metadata is automatically extracted from the program
|
|
146
|
+
* const manPage = generateManPage(prog, { section: 1 });
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* @param parserOrProgram The parser or program to generate documentation from.
|
|
150
|
+
* @param options The man page generation options.
|
|
151
|
+
* @returns The complete man page in roff format, or a Promise for async parsers.
|
|
152
|
+
* @throws {TypeError} If the input is not a valid Parser or Program.
|
|
153
|
+
* @since 0.10.0
|
|
154
|
+
*/
|
|
155
|
+
declare function generateManPage<T>(program: Program<"sync", T>, options: GenerateManPageProgramOptions): string;
|
|
156
|
+
declare function generateManPage<T>(program: Program<"async", T>, options: GenerateManPageProgramOptions): Promise<string>;
|
|
157
|
+
declare function generateManPage(parser: Parser<"sync", unknown, unknown>, options: GenerateManPageOptions): string;
|
|
158
|
+
declare function generateManPage(parser: Parser<"async", unknown, unknown>, options: GenerateManPageOptions): Promise<string>;
|
|
159
|
+
declare function generateManPage<M extends Mode>(parser: Parser<M, unknown, unknown>, options: GenerateManPageOptions): ModeValue<M, string>;
|
|
160
|
+
//#endregion
|
|
161
|
+
export { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { ManPageOptions } from "./man-CHYiSoI_.js";
|
|
2
|
+
import { Program } from "@optique/core/program";
|
|
3
|
+
import { Mode, ModeValue, Parser } from "@optique/core/parser";
|
|
4
|
+
|
|
5
|
+
//#region src/generator.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Options for generating a man page from a parser.
|
|
9
|
+
* Extends {@link ManPageOptions} with the same configuration.
|
|
10
|
+
* @since 0.10.0
|
|
11
|
+
*/
|
|
12
|
+
interface GenerateManPageOptions extends ManPageOptions {}
|
|
13
|
+
/**
|
|
14
|
+
* Options for generating a man page from a {@link Program}.
|
|
15
|
+
*
|
|
16
|
+
* For Program inputs, `name`, `version`, `author`, `bugs`, `examples`,
|
|
17
|
+
* `brief`, `description`, and `footer` default to values from
|
|
18
|
+
* `program.metadata`.
|
|
19
|
+
* These fields are optional here and may be provided to override metadata.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.10.0
|
|
22
|
+
*/
|
|
23
|
+
interface GenerateManPageProgramOptions extends Partial<Omit<ManPageOptions, "section">>, Pick<ManPageOptions, "section"> {}
|
|
24
|
+
/**
|
|
25
|
+
* Generates a man page from a parser synchronously.
|
|
26
|
+
*
|
|
27
|
+
* This function extracts documentation from the parser's structure
|
|
28
|
+
* and formats it as a complete man page in roff format.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* import { generateManPageSync } from "@optique/man";
|
|
33
|
+
* import { object, option, flag } from "@optique/core/primitives";
|
|
34
|
+
* import { string } from "@optique/core/valueparser";
|
|
35
|
+
*
|
|
36
|
+
* const parser = object({
|
|
37
|
+
* verbose: flag("-v", "--verbose"),
|
|
38
|
+
* config: option("-c", "--config", string()),
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* const manPage = generateManPageSync(parser, {
|
|
42
|
+
* name: "myapp",
|
|
43
|
+
* section: 1,
|
|
44
|
+
* version: "1.0.0",
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* console.log(manPage);
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @param parserOrProgram The parser or program to generate documentation from.
|
|
51
|
+
* @param options The man page generation options.
|
|
52
|
+
* @returns The complete man page in roff format.
|
|
53
|
+
* @throws {TypeError} If the input is not a valid Parser or Program.
|
|
54
|
+
* @since 0.10.0
|
|
55
|
+
*/
|
|
56
|
+
declare function generateManPageSync<T>(program: Program<"sync", T>, options: GenerateManPageProgramOptions): string;
|
|
57
|
+
declare function generateManPageSync(parser: Parser<"sync", unknown, unknown>, options: GenerateManPageOptions): string;
|
|
58
|
+
/**
|
|
59
|
+
* Generates a man page from a parser asynchronously.
|
|
60
|
+
*
|
|
61
|
+
* This function extracts documentation from the parser's structure
|
|
62
|
+
* and formats it as a complete man page in roff format. It supports
|
|
63
|
+
* both sync and async parsers.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { generateManPageAsync } from "@optique/man";
|
|
68
|
+
* import { object, option } from "@optique/core/primitives";
|
|
69
|
+
* import { string } from "@optique/core/valueparser";
|
|
70
|
+
*
|
|
71
|
+
* const parser = object({
|
|
72
|
+
* config: option("-c", "--config", string()),
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* const manPage = await generateManPageAsync(parser, {
|
|
76
|
+
* name: "myapp",
|
|
77
|
+
* section: 1,
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @param parserOrProgram The parser or program to generate documentation from.
|
|
82
|
+
* @param options The man page generation options.
|
|
83
|
+
* @returns A promise that resolves to the complete man page in roff format.
|
|
84
|
+
* @throws {TypeError} If the input is not a valid Parser or Program.
|
|
85
|
+
* @since 0.10.0
|
|
86
|
+
*/
|
|
87
|
+
declare function generateManPageAsync<M extends Mode, T>(program: Program<M, T>, options: GenerateManPageProgramOptions): Promise<string>;
|
|
88
|
+
declare function generateManPageAsync<M extends Mode>(parser: Parser<M, unknown, unknown>, options: GenerateManPageOptions): Promise<string>;
|
|
89
|
+
/**
|
|
90
|
+
* Generates a man page from a parser or program.
|
|
91
|
+
*
|
|
92
|
+
* This function extracts documentation from the parser's structure
|
|
93
|
+
* and formats it as a complete man page in roff format.
|
|
94
|
+
*
|
|
95
|
+
* For sync parsers, it returns the man page directly.
|
|
96
|
+
* For async parsers, it returns a Promise that resolves to the man page.
|
|
97
|
+
*
|
|
98
|
+
* @example Parser-based API
|
|
99
|
+
* ```typescript
|
|
100
|
+
* import { generateManPage } from "@optique/man";
|
|
101
|
+
* import { object, option, flag } from "@optique/core/primitives";
|
|
102
|
+
* import { string, integer } from "@optique/core/valueparser";
|
|
103
|
+
* import { message } from "@optique/core/message";
|
|
104
|
+
*
|
|
105
|
+
* const parser = object({
|
|
106
|
+
* verbose: flag("-v", "--verbose", {
|
|
107
|
+
* description: message`Enable verbose output.`,
|
|
108
|
+
* }),
|
|
109
|
+
* port: option("-p", "--port", integer(), {
|
|
110
|
+
* description: message`Port to listen on.`,
|
|
111
|
+
* }),
|
|
112
|
+
* });
|
|
113
|
+
*
|
|
114
|
+
* const manPage = generateManPage(parser, {
|
|
115
|
+
* name: "myapp",
|
|
116
|
+
* section: 1,
|
|
117
|
+
* version: "1.0.0",
|
|
118
|
+
* date: new Date(),
|
|
119
|
+
* author: message`Hong Minhee`,
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
122
|
+
* // Write to file
|
|
123
|
+
* import { writeFileSync } from "node:fs";
|
|
124
|
+
* writeFileSync("myapp.1", manPage);
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @example Program-based API
|
|
128
|
+
* ```typescript
|
|
129
|
+
* import { generateManPage } from "@optique/man";
|
|
130
|
+
* import { defineProgram } from "@optique/core/program";
|
|
131
|
+
* import { object, flag } from "@optique/core/primitives";
|
|
132
|
+
* import { message } from "@optique/core/message";
|
|
133
|
+
*
|
|
134
|
+
* const prog = defineProgram({
|
|
135
|
+
* parser: object({
|
|
136
|
+
* verbose: flag("-v", "--verbose"),
|
|
137
|
+
* }),
|
|
138
|
+
* metadata: {
|
|
139
|
+
* name: "myapp",
|
|
140
|
+
* version: "1.0.0",
|
|
141
|
+
* author: message`Hong Minhee`,
|
|
142
|
+
* },
|
|
143
|
+
* });
|
|
144
|
+
*
|
|
145
|
+
* // Metadata is automatically extracted from the program
|
|
146
|
+
* const manPage = generateManPage(prog, { section: 1 });
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* @param parserOrProgram The parser or program to generate documentation from.
|
|
150
|
+
* @param options The man page generation options.
|
|
151
|
+
* @returns The complete man page in roff format, or a Promise for async parsers.
|
|
152
|
+
* @throws {TypeError} If the input is not a valid Parser or Program.
|
|
153
|
+
* @since 0.10.0
|
|
154
|
+
*/
|
|
155
|
+
declare function generateManPage<T>(program: Program<"sync", T>, options: GenerateManPageProgramOptions): string;
|
|
156
|
+
declare function generateManPage<T>(program: Program<"async", T>, options: GenerateManPageProgramOptions): Promise<string>;
|
|
157
|
+
declare function generateManPage(parser: Parser<"sync", unknown, unknown>, options: GenerateManPageOptions): string;
|
|
158
|
+
declare function generateManPage(parser: Parser<"async", unknown, unknown>, options: GenerateManPageOptions): Promise<string>;
|
|
159
|
+
declare function generateManPage<M extends Mode>(parser: Parser<M, unknown, unknown>, options: GenerateManPageOptions): ModeValue<M, string>;
|
|
160
|
+
//#endregion
|
|
161
|
+
export { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
require('./man-C44Q4VSc.cjs');
|
|
2
|
+
require('./roff-C8MvQ2tL.cjs');
|
|
3
|
+
const require_generator = require('./generator-CtkCu_MS.cjs');
|
|
4
|
+
|
|
5
|
+
exports.generateManPage = require_generator.generateManPage;
|
|
6
|
+
exports.generateManPageAsync = require_generator.generateManPageAsync;
|
|
7
|
+
exports.generateManPageSync = require_generator.generateManPageSync;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "./man-C3FUTPuQ.cjs";
|
|
2
|
+
import { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync } from "./generator-I9cXlw1Z.cjs";
|
|
3
|
+
export { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "./man-CHYiSoI_.js";
|
|
2
|
+
import { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync } from "./generator-MbR1I1SH.js";
|
|
3
|
+
export { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync };
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_man = require('./man-
|
|
1
|
+
const require_man = require('./man-C44Q4VSc.cjs');
|
|
2
2
|
const require_roff = require('./roff-C8MvQ2tL.cjs');
|
|
3
|
-
const require_generator = require('./generator-
|
|
3
|
+
const require_generator = require('./generator-CtkCu_MS.cjs');
|
|
4
4
|
|
|
5
5
|
exports.escapeHyphens = require_roff.escapeHyphens;
|
|
6
6
|
exports.escapeQuotedValue = require_roff.escapeQuotedValue;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,162 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Program } from "@optique/core/program";
|
|
5
|
-
|
|
6
|
-
//#region src/generator.d.ts
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Options for generating a man page from a parser.
|
|
10
|
-
* Extends {@link ManPageOptions} with the same configuration.
|
|
11
|
-
* @since 0.10.0
|
|
12
|
-
*/
|
|
13
|
-
interface GenerateManPageOptions extends ManPageOptions {}
|
|
14
|
-
/**
|
|
15
|
-
* Options for generating a man page from a {@link Program}.
|
|
16
|
-
*
|
|
17
|
-
* For Program inputs, `name`, `version`, `author`, `bugs`, `examples`,
|
|
18
|
-
* `brief`, `description`, and `footer` default to values from
|
|
19
|
-
* `program.metadata`.
|
|
20
|
-
* These fields are optional here and may be provided to override metadata.
|
|
21
|
-
*
|
|
22
|
-
* @since 0.10.0
|
|
23
|
-
*/
|
|
24
|
-
interface GenerateManPageProgramOptions extends Partial<Omit<ManPageOptions, "section">>, Pick<ManPageOptions, "section"> {}
|
|
25
|
-
/**
|
|
26
|
-
* Generates a man page from a parser synchronously.
|
|
27
|
-
*
|
|
28
|
-
* This function extracts documentation from the parser's structure
|
|
29
|
-
* and formats it as a complete man page in roff format.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* import { generateManPageSync } from "@optique/man";
|
|
34
|
-
* import { object, option, flag } from "@optique/core/primitives";
|
|
35
|
-
* import { string } from "@optique/core/valueparser";
|
|
36
|
-
*
|
|
37
|
-
* const parser = object({
|
|
38
|
-
* verbose: flag("-v", "--verbose"),
|
|
39
|
-
* config: option("-c", "--config", string()),
|
|
40
|
-
* });
|
|
41
|
-
*
|
|
42
|
-
* const manPage = generateManPageSync(parser, {
|
|
43
|
-
* name: "myapp",
|
|
44
|
-
* section: 1,
|
|
45
|
-
* version: "1.0.0",
|
|
46
|
-
* });
|
|
47
|
-
*
|
|
48
|
-
* console.log(manPage);
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @param parserOrProgram The parser or program to generate documentation from.
|
|
52
|
-
* @param options The man page generation options.
|
|
53
|
-
* @returns The complete man page in roff format.
|
|
54
|
-
* @throws {TypeError} If the input is not a valid Parser or Program.
|
|
55
|
-
* @since 0.10.0
|
|
56
|
-
*/
|
|
57
|
-
declare function generateManPageSync<T>(program: Program<"sync", T>, options: GenerateManPageProgramOptions): string;
|
|
58
|
-
declare function generateManPageSync(parser: Parser<"sync", unknown, unknown>, options: GenerateManPageOptions): string;
|
|
59
|
-
/**
|
|
60
|
-
* Generates a man page from a parser asynchronously.
|
|
61
|
-
*
|
|
62
|
-
* This function extracts documentation from the parser's structure
|
|
63
|
-
* and formats it as a complete man page in roff format. It supports
|
|
64
|
-
* both sync and async parsers.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```typescript
|
|
68
|
-
* import { generateManPageAsync } from "@optique/man";
|
|
69
|
-
* import { object, option } from "@optique/core/primitives";
|
|
70
|
-
* import { string } from "@optique/core/valueparser";
|
|
71
|
-
*
|
|
72
|
-
* const parser = object({
|
|
73
|
-
* config: option("-c", "--config", string()),
|
|
74
|
-
* });
|
|
75
|
-
*
|
|
76
|
-
* const manPage = await generateManPageAsync(parser, {
|
|
77
|
-
* name: "myapp",
|
|
78
|
-
* section: 1,
|
|
79
|
-
* });
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* @param parserOrProgram The parser or program to generate documentation from.
|
|
83
|
-
* @param options The man page generation options.
|
|
84
|
-
* @returns A promise that resolves to the complete man page in roff format.
|
|
85
|
-
* @throws {TypeError} If the input is not a valid Parser or Program.
|
|
86
|
-
* @since 0.10.0
|
|
87
|
-
*/
|
|
88
|
-
declare function generateManPageAsync<M extends Mode, T>(program: Program<M, T>, options: GenerateManPageProgramOptions): Promise<string>;
|
|
89
|
-
declare function generateManPageAsync<M extends Mode>(parser: Parser<M, unknown, unknown>, options: GenerateManPageOptions): Promise<string>;
|
|
90
|
-
/**
|
|
91
|
-
* Generates a man page from a parser or program.
|
|
92
|
-
*
|
|
93
|
-
* This function extracts documentation from the parser's structure
|
|
94
|
-
* and formats it as a complete man page in roff format.
|
|
95
|
-
*
|
|
96
|
-
* For sync parsers, it returns the man page directly.
|
|
97
|
-
* For async parsers, it returns a Promise that resolves to the man page.
|
|
98
|
-
*
|
|
99
|
-
* @example Parser-based API
|
|
100
|
-
* ```typescript
|
|
101
|
-
* import { generateManPage } from "@optique/man";
|
|
102
|
-
* import { object, option, flag } from "@optique/core/primitives";
|
|
103
|
-
* import { string, integer } from "@optique/core/valueparser";
|
|
104
|
-
* import { message } from "@optique/core/message";
|
|
105
|
-
*
|
|
106
|
-
* const parser = object({
|
|
107
|
-
* verbose: flag("-v", "--verbose", {
|
|
108
|
-
* description: message`Enable verbose output.`,
|
|
109
|
-
* }),
|
|
110
|
-
* port: option("-p", "--port", integer(), {
|
|
111
|
-
* description: message`Port to listen on.`,
|
|
112
|
-
* }),
|
|
113
|
-
* });
|
|
114
|
-
*
|
|
115
|
-
* const manPage = generateManPage(parser, {
|
|
116
|
-
* name: "myapp",
|
|
117
|
-
* section: 1,
|
|
118
|
-
* version: "1.0.0",
|
|
119
|
-
* date: new Date(),
|
|
120
|
-
* author: message`Hong Minhee`,
|
|
121
|
-
* });
|
|
122
|
-
*
|
|
123
|
-
* // Write to file
|
|
124
|
-
* import { writeFileSync } from "node:fs";
|
|
125
|
-
* writeFileSync("myapp.1", manPage);
|
|
126
|
-
* ```
|
|
127
|
-
*
|
|
128
|
-
* @example Program-based API
|
|
129
|
-
* ```typescript
|
|
130
|
-
* import { generateManPage } from "@optique/man";
|
|
131
|
-
* import { defineProgram } from "@optique/core/program";
|
|
132
|
-
* import { object, flag } from "@optique/core/primitives";
|
|
133
|
-
* import { message } from "@optique/core/message";
|
|
134
|
-
*
|
|
135
|
-
* const prog = defineProgram({
|
|
136
|
-
* parser: object({
|
|
137
|
-
* verbose: flag("-v", "--verbose"),
|
|
138
|
-
* }),
|
|
139
|
-
* metadata: {
|
|
140
|
-
* name: "myapp",
|
|
141
|
-
* version: "1.0.0",
|
|
142
|
-
* author: message`Hong Minhee`,
|
|
143
|
-
* },
|
|
144
|
-
* });
|
|
145
|
-
*
|
|
146
|
-
* // Metadata is automatically extracted from the program
|
|
147
|
-
* const manPage = generateManPage(prog, { section: 1 });
|
|
148
|
-
* ```
|
|
149
|
-
*
|
|
150
|
-
* @param parserOrProgram The parser or program to generate documentation from.
|
|
151
|
-
* @param options The man page generation options.
|
|
152
|
-
* @returns The complete man page in roff format, or a Promise for async parsers.
|
|
153
|
-
* @throws {TypeError} If the input is not a valid Parser or Program.
|
|
154
|
-
* @since 0.10.0
|
|
155
|
-
*/
|
|
156
|
-
declare function generateManPage<T>(program: Program<"sync", T>, options: GenerateManPageProgramOptions): string;
|
|
157
|
-
declare function generateManPage<T>(program: Program<"async", T>, options: GenerateManPageProgramOptions): Promise<string>;
|
|
158
|
-
declare function generateManPage(parser: Parser<"sync", unknown, unknown>, options: GenerateManPageOptions): string;
|
|
159
|
-
declare function generateManPage(parser: Parser<"async", unknown, unknown>, options: GenerateManPageOptions): Promise<string>;
|
|
160
|
-
declare function generateManPage<M extends Mode>(parser: Parser<M, unknown, unknown>, options: GenerateManPageOptions): ModeValue<M, string>;
|
|
161
|
-
//#endregion
|
|
1
|
+
import { ManPageOptions, formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-C3FUTPuQ.cjs";
|
|
2
|
+
import { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync } from "./generator-I9cXlw1Z.cjs";
|
|
3
|
+
import { RoffFormatOptions, escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatMessageAsRoff } from "./roff-Cpm_FJok.cjs";
|
|
162
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,162 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Mode, ModeValue, Parser } from "@optique/core/parser";
|
|
5
|
-
|
|
6
|
-
//#region src/generator.d.ts
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Options for generating a man page from a parser.
|
|
10
|
-
* Extends {@link ManPageOptions} with the same configuration.
|
|
11
|
-
* @since 0.10.0
|
|
12
|
-
*/
|
|
13
|
-
interface GenerateManPageOptions extends ManPageOptions {}
|
|
14
|
-
/**
|
|
15
|
-
* Options for generating a man page from a {@link Program}.
|
|
16
|
-
*
|
|
17
|
-
* For Program inputs, `name`, `version`, `author`, `bugs`, `examples`,
|
|
18
|
-
* `brief`, `description`, and `footer` default to values from
|
|
19
|
-
* `program.metadata`.
|
|
20
|
-
* These fields are optional here and may be provided to override metadata.
|
|
21
|
-
*
|
|
22
|
-
* @since 0.10.0
|
|
23
|
-
*/
|
|
24
|
-
interface GenerateManPageProgramOptions extends Partial<Omit<ManPageOptions, "section">>, Pick<ManPageOptions, "section"> {}
|
|
25
|
-
/**
|
|
26
|
-
* Generates a man page from a parser synchronously.
|
|
27
|
-
*
|
|
28
|
-
* This function extracts documentation from the parser's structure
|
|
29
|
-
* and formats it as a complete man page in roff format.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* import { generateManPageSync } from "@optique/man";
|
|
34
|
-
* import { object, option, flag } from "@optique/core/primitives";
|
|
35
|
-
* import { string } from "@optique/core/valueparser";
|
|
36
|
-
*
|
|
37
|
-
* const parser = object({
|
|
38
|
-
* verbose: flag("-v", "--verbose"),
|
|
39
|
-
* config: option("-c", "--config", string()),
|
|
40
|
-
* });
|
|
41
|
-
*
|
|
42
|
-
* const manPage = generateManPageSync(parser, {
|
|
43
|
-
* name: "myapp",
|
|
44
|
-
* section: 1,
|
|
45
|
-
* version: "1.0.0",
|
|
46
|
-
* });
|
|
47
|
-
*
|
|
48
|
-
* console.log(manPage);
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @param parserOrProgram The parser or program to generate documentation from.
|
|
52
|
-
* @param options The man page generation options.
|
|
53
|
-
* @returns The complete man page in roff format.
|
|
54
|
-
* @throws {TypeError} If the input is not a valid Parser or Program.
|
|
55
|
-
* @since 0.10.0
|
|
56
|
-
*/
|
|
57
|
-
declare function generateManPageSync<T>(program: Program<"sync", T>, options: GenerateManPageProgramOptions): string;
|
|
58
|
-
declare function generateManPageSync(parser: Parser<"sync", unknown, unknown>, options: GenerateManPageOptions): string;
|
|
59
|
-
/**
|
|
60
|
-
* Generates a man page from a parser asynchronously.
|
|
61
|
-
*
|
|
62
|
-
* This function extracts documentation from the parser's structure
|
|
63
|
-
* and formats it as a complete man page in roff format. It supports
|
|
64
|
-
* both sync and async parsers.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```typescript
|
|
68
|
-
* import { generateManPageAsync } from "@optique/man";
|
|
69
|
-
* import { object, option } from "@optique/core/primitives";
|
|
70
|
-
* import { string } from "@optique/core/valueparser";
|
|
71
|
-
*
|
|
72
|
-
* const parser = object({
|
|
73
|
-
* config: option("-c", "--config", string()),
|
|
74
|
-
* });
|
|
75
|
-
*
|
|
76
|
-
* const manPage = await generateManPageAsync(parser, {
|
|
77
|
-
* name: "myapp",
|
|
78
|
-
* section: 1,
|
|
79
|
-
* });
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* @param parserOrProgram The parser or program to generate documentation from.
|
|
83
|
-
* @param options The man page generation options.
|
|
84
|
-
* @returns A promise that resolves to the complete man page in roff format.
|
|
85
|
-
* @throws {TypeError} If the input is not a valid Parser or Program.
|
|
86
|
-
* @since 0.10.0
|
|
87
|
-
*/
|
|
88
|
-
declare function generateManPageAsync<M extends Mode, T>(program: Program<M, T>, options: GenerateManPageProgramOptions): Promise<string>;
|
|
89
|
-
declare function generateManPageAsync<M extends Mode>(parser: Parser<M, unknown, unknown>, options: GenerateManPageOptions): Promise<string>;
|
|
90
|
-
/**
|
|
91
|
-
* Generates a man page from a parser or program.
|
|
92
|
-
*
|
|
93
|
-
* This function extracts documentation from the parser's structure
|
|
94
|
-
* and formats it as a complete man page in roff format.
|
|
95
|
-
*
|
|
96
|
-
* For sync parsers, it returns the man page directly.
|
|
97
|
-
* For async parsers, it returns a Promise that resolves to the man page.
|
|
98
|
-
*
|
|
99
|
-
* @example Parser-based API
|
|
100
|
-
* ```typescript
|
|
101
|
-
* import { generateManPage } from "@optique/man";
|
|
102
|
-
* import { object, option, flag } from "@optique/core/primitives";
|
|
103
|
-
* import { string, integer } from "@optique/core/valueparser";
|
|
104
|
-
* import { message } from "@optique/core/message";
|
|
105
|
-
*
|
|
106
|
-
* const parser = object({
|
|
107
|
-
* verbose: flag("-v", "--verbose", {
|
|
108
|
-
* description: message`Enable verbose output.`,
|
|
109
|
-
* }),
|
|
110
|
-
* port: option("-p", "--port", integer(), {
|
|
111
|
-
* description: message`Port to listen on.`,
|
|
112
|
-
* }),
|
|
113
|
-
* });
|
|
114
|
-
*
|
|
115
|
-
* const manPage = generateManPage(parser, {
|
|
116
|
-
* name: "myapp",
|
|
117
|
-
* section: 1,
|
|
118
|
-
* version: "1.0.0",
|
|
119
|
-
* date: new Date(),
|
|
120
|
-
* author: message`Hong Minhee`,
|
|
121
|
-
* });
|
|
122
|
-
*
|
|
123
|
-
* // Write to file
|
|
124
|
-
* import { writeFileSync } from "node:fs";
|
|
125
|
-
* writeFileSync("myapp.1", manPage);
|
|
126
|
-
* ```
|
|
127
|
-
*
|
|
128
|
-
* @example Program-based API
|
|
129
|
-
* ```typescript
|
|
130
|
-
* import { generateManPage } from "@optique/man";
|
|
131
|
-
* import { defineProgram } from "@optique/core/program";
|
|
132
|
-
* import { object, flag } from "@optique/core/primitives";
|
|
133
|
-
* import { message } from "@optique/core/message";
|
|
134
|
-
*
|
|
135
|
-
* const prog = defineProgram({
|
|
136
|
-
* parser: object({
|
|
137
|
-
* verbose: flag("-v", "--verbose"),
|
|
138
|
-
* }),
|
|
139
|
-
* metadata: {
|
|
140
|
-
* name: "myapp",
|
|
141
|
-
* version: "1.0.0",
|
|
142
|
-
* author: message`Hong Minhee`,
|
|
143
|
-
* },
|
|
144
|
-
* });
|
|
145
|
-
*
|
|
146
|
-
* // Metadata is automatically extracted from the program
|
|
147
|
-
* const manPage = generateManPage(prog, { section: 1 });
|
|
148
|
-
* ```
|
|
149
|
-
*
|
|
150
|
-
* @param parserOrProgram The parser or program to generate documentation from.
|
|
151
|
-
* @param options The man page generation options.
|
|
152
|
-
* @returns The complete man page in roff format, or a Promise for async parsers.
|
|
153
|
-
* @throws {TypeError} If the input is not a valid Parser or Program.
|
|
154
|
-
* @since 0.10.0
|
|
155
|
-
*/
|
|
156
|
-
declare function generateManPage<T>(program: Program<"sync", T>, options: GenerateManPageProgramOptions): string;
|
|
157
|
-
declare function generateManPage<T>(program: Program<"async", T>, options: GenerateManPageProgramOptions): Promise<string>;
|
|
158
|
-
declare function generateManPage(parser: Parser<"sync", unknown, unknown>, options: GenerateManPageOptions): string;
|
|
159
|
-
declare function generateManPage(parser: Parser<"async", unknown, unknown>, options: GenerateManPageOptions): Promise<string>;
|
|
160
|
-
declare function generateManPage<M extends Mode>(parser: Parser<M, unknown, unknown>, options: GenerateManPageOptions): ModeValue<M, string>;
|
|
161
|
-
//#endregion
|
|
1
|
+
import { ManPageOptions, formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff } from "./man-CHYiSoI_.js";
|
|
2
|
+
import { GenerateManPageOptions, GenerateManPageProgramOptions, generateManPage, generateManPageAsync, generateManPageSync } from "./generator-MbR1I1SH.js";
|
|
3
|
+
import { RoffFormatOptions, escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatMessageAsRoff } from "./roff-DkJvVQ1o.js";
|
|
162
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-Cq0qfXg0.js";
|
|
3
|
+
import { generateManPage, generateManPageAsync, generateManPageSync } from "./generator-DywTJCMH.js";
|
|
4
4
|
|
|
5
5
|
export { escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatDateForMan, formatDocPageAsMan, formatMessageAsRoff, formatUsageTermAsRoff, generateManPage, generateManPageAsync, generateManPageSync };
|
|
@@ -130,6 +130,7 @@ function formatUsageTermAsRoffInternal(term, insideBrackets) {
|
|
|
130
130
|
if (alternatives.length === 1) return alternatives[0];
|
|
131
131
|
return `(${alternatives.join(" | ")})`;
|
|
132
132
|
}
|
|
133
|
+
case "sequence": return formatUsageAsRoffInternal(term.terms, insideBrackets);
|
|
133
134
|
case "literal": return require_roff.escapeRoff(term.value);
|
|
134
135
|
case "passthrough": return "[...]";
|
|
135
136
|
case "ellipsis": return "...";
|
|
@@ -197,6 +198,7 @@ function formatDocUsageTermAsRoff(term) {
|
|
|
197
198
|
if (alternatives.length === 1) return alternatives[0];
|
|
198
199
|
return `(${alternatives.join(" | ")})`;
|
|
199
200
|
}
|
|
201
|
+
case "sequence": return formatDocUsageAsRoff(term.terms);
|
|
200
202
|
case "argument": return `\\fI${require_roff.escapeRoff(term.metavar)}\\fR`;
|
|
201
203
|
case "option": {
|
|
202
204
|
const names = term.names.map((name) => `\\fB${require_roff.escapeHyphens(name)}\\fR`).join(", ");
|
|
@@ -107,6 +107,7 @@ function formatUsageTermAsRoffInternal(term, insideBrackets) {
|
|
|
107
107
|
if (alternatives.length === 1) return alternatives[0];
|
|
108
108
|
return `(${alternatives.join(" | ")})`;
|
|
109
109
|
}
|
|
110
|
+
case "sequence": return formatUsageAsRoffInternal(term.terms, insideBrackets);
|
|
110
111
|
case "literal": return escapeRoff(term.value);
|
|
111
112
|
case "passthrough": return "[...]";
|
|
112
113
|
case "ellipsis": return "...";
|
|
@@ -174,6 +175,7 @@ function formatDocUsageTermAsRoff(term) {
|
|
|
174
175
|
if (alternatives.length === 1) return alternatives[0];
|
|
175
176
|
return `(${alternatives.join(" | ")})`;
|
|
176
177
|
}
|
|
178
|
+
case "sequence": return formatDocUsageAsRoff(term.terms);
|
|
177
179
|
case "argument": return `\\fI${escapeRoff(term.metavar)}\\fR`;
|
|
178
180
|
case "option": {
|
|
179
181
|
const names = term.names.map((name) => `\\fB${escapeHyphens(name)}\\fR`).join(", ");
|
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-C3FUTPuQ.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-CHYiSoI_.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-Cq0qfXg0.js";
|
|
3
3
|
|
|
4
4
|
export { formatDateForMan, formatDocPageAsMan, formatUsageTermAsRoff };
|
package/dist/roff.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RoffFormatOptions, escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatMessageAsRoff } from "./roff-
|
|
1
|
+
import { RoffFormatOptions, escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatMessageAsRoff } from "./roff-Cpm_FJok.cjs";
|
|
2
2
|
export { RoffFormatOptions, escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatMessageAsRoff };
|
package/dist/roff.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RoffFormatOptions, escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatMessageAsRoff } from "./roff-
|
|
1
|
+
import { RoffFormatOptions, escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatMessageAsRoff } from "./roff-DkJvVQ1o.js";
|
|
2
2
|
export { RoffFormatOptions, escapeHyphens, escapeQuotedValue, escapeRequestArg, escapeRoff, formatMessageAsRoff };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/man",
|
|
3
|
-
"version": "1.1.0-dev.
|
|
3
|
+
"version": "1.1.0-dev.2146",
|
|
4
4
|
"description": "Man page generator for Optique CLI parsers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -79,13 +79,19 @@
|
|
|
79
79
|
"require": "./dist/cli.cjs"
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
|
+
"imports": {
|
|
83
|
+
"#src/*.ts": {
|
|
84
|
+
"node": "./dist/*.js",
|
|
85
|
+
"default": "./src/*.ts"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
82
88
|
"sideEffects": false,
|
|
83
89
|
"bin": {
|
|
84
90
|
"optique-man": "./dist/cli.js"
|
|
85
91
|
},
|
|
86
92
|
"dependencies": {
|
|
87
|
-
"@optique/
|
|
88
|
-
"@optique/
|
|
93
|
+
"@optique/core": "1.1.0-dev.2146+5fd0a75e",
|
|
94
|
+
"@optique/run": "1.1.0-dev.2146+5fd0a75e"
|
|
89
95
|
},
|
|
90
96
|
"devDependencies": {
|
|
91
97
|
"@types/node": "^24.0.0",
|
|
@@ -96,9 +102,9 @@
|
|
|
96
102
|
"scripts": {
|
|
97
103
|
"build": "tsdown",
|
|
98
104
|
"prepublish": "tsdown",
|
|
99
|
-
"test": "node --
|
|
105
|
+
"test": "node --test 'src/**/*.test.ts'",
|
|
100
106
|
"test:bun": "bun test src/",
|
|
101
107
|
"test:deno": "deno test",
|
|
102
|
-
"test-all": "tsdown && node --
|
|
108
|
+
"test-all": "tsdown && node --test 'src/**/*.test.ts' && bun test src/ && deno test"
|
|
103
109
|
}
|
|
104
110
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|