@gunshi/docs 0.27.4 → 0.27.6
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/package.json +1 -1
- package/src/api/default/functions/cli.md +26 -21
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ A [CLI options](../interfaces/CliOptions.md)
|
|
|
23
23
|
## Call Signature
|
|
24
24
|
|
|
25
25
|
```ts
|
|
26
|
-
function cli(
|
|
26
|
+
function cli<G>(
|
|
27
27
|
args,
|
|
28
28
|
entry,
|
|
29
29
|
options?): Promise<string | undefined>;
|
|
@@ -31,16 +31,19 @@ options?): Promise<string | undefined>;
|
|
|
31
31
|
|
|
32
32
|
Run the command.
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
### Type Parameters
|
|
35
|
+
|
|
36
|
+
| Type Parameter | Description |
|
|
37
|
+
| ------ | ------ |
|
|
38
|
+
| `G` *extends* [`GunshiParamsConstraint`](../type-aliases/GunshiParamsConstraint.md) | A type extending [`GunshiParams`](../interfaces/GunshiParams.md) to specify the shape of command and cli options. |
|
|
36
39
|
|
|
37
40
|
### Parameters
|
|
38
41
|
|
|
39
42
|
| Parameter | Type | Description |
|
|
40
43
|
| ------ | ------ | ------ |
|
|
41
44
|
| `args` | `string`[] | Command line arguments |
|
|
42
|
-
| `entry` | [`
|
|
43
|
-
| `options?` | [`CliOptions`](../interfaces/CliOptions.md)
|
|
45
|
+
| `entry` | \| [`Command`](../interfaces/Command.md)\<`G`\> \| [`CommandRunner`](../type-aliases/CommandRunner.md)\<`G`\> \| [`LazyCommand`](../type-aliases/LazyCommand.md)\<`G`\> | A [entry command](../interfaces/Command.md), an [inline command runner](../type-aliases/CommandRunner.md), or a [lazily-loaded command](../type-aliases/LazyCommand.md) |
|
|
46
|
+
| `options?` | [`CliOptions`](../interfaces/CliOptions.md)\<`G`\> | A [CLI options](../interfaces/CliOptions.md) |
|
|
44
47
|
|
|
45
48
|
### Returns
|
|
46
49
|
|
|
@@ -51,7 +54,7 @@ A rendered usage or undefined. if you will use [`CliOptions.usageSilent`](../int
|
|
|
51
54
|
## Call Signature
|
|
52
55
|
|
|
53
56
|
```ts
|
|
54
|
-
function cli<G>(
|
|
57
|
+
function cli<A, G>(
|
|
55
58
|
args,
|
|
56
59
|
entry,
|
|
57
60
|
options?): Promise<string | undefined>;
|
|
@@ -61,9 +64,10 @@ Run the command.
|
|
|
61
64
|
|
|
62
65
|
### Type Parameters
|
|
63
66
|
|
|
64
|
-
| Type Parameter | Description |
|
|
65
|
-
| ------ | ------ |
|
|
66
|
-
| `
|
|
67
|
+
| Type Parameter | Default type | Description |
|
|
68
|
+
| ------ | ------ | ------ |
|
|
69
|
+
| `A` *extends* [`Args`](../interfaces/Args.md) | [`Args`](../interfaces/Args.md) | The type of [`arguments`](../interfaces/Args.md) defined in the command and cli options. |
|
|
70
|
+
| `G` *extends* [`GunshiParams`](../interfaces/GunshiParams.md)\<\{ `args`: [`Args`](../interfaces/Args.md); `extensions`: \{ \}; \}\> | `object` | - |
|
|
67
71
|
|
|
68
72
|
### Parameters
|
|
69
73
|
|
|
@@ -82,7 +86,7 @@ A rendered usage or undefined. if you will use [`CliOptions.usageSilent`](../int
|
|
|
82
86
|
## Call Signature
|
|
83
87
|
|
|
84
88
|
```ts
|
|
85
|
-
function cli<
|
|
89
|
+
function cli<E, G>(
|
|
86
90
|
args,
|
|
87
91
|
entry,
|
|
88
92
|
options?): Promise<string | undefined>;
|
|
@@ -94,7 +98,7 @@ Run the command.
|
|
|
94
98
|
|
|
95
99
|
| Type Parameter | Default type | Description |
|
|
96
100
|
| ------ | ------ | ------ |
|
|
97
|
-
| `
|
|
101
|
+
| `E` *extends* [`ExtendContext`](../type-aliases/ExtendContext.md) | [`ExtendContext`](../type-aliases/ExtendContext.md) | An [`ExtendContext`](../type-aliases/ExtendContext.md) type to specify the shape of command and cli options. |
|
|
98
102
|
| `G` *extends* [`GunshiParams`](../interfaces/GunshiParams.md)\<\{ `args`: [`Args`](../interfaces/Args.md); `extensions`: \{ \}; \}\> | `object` | - |
|
|
99
103
|
|
|
100
104
|
### Parameters
|
|
@@ -114,7 +118,7 @@ A rendered usage or undefined. if you will use [`CliOptions.usageSilent`](../int
|
|
|
114
118
|
## Call Signature
|
|
115
119
|
|
|
116
120
|
```ts
|
|
117
|
-
function cli<
|
|
121
|
+
function cli<G>(
|
|
118
122
|
args,
|
|
119
123
|
entry,
|
|
120
124
|
options?): Promise<string | undefined>;
|
|
@@ -126,8 +130,7 @@ Run the command.
|
|
|
126
130
|
|
|
127
131
|
| Type Parameter | Default type | Description |
|
|
128
132
|
| ------ | ------ | ------ |
|
|
129
|
-
| `
|
|
130
|
-
| `G` *extends* [`GunshiParams`](../interfaces/GunshiParams.md)\<\{ `args`: [`Args`](../interfaces/Args.md); `extensions`: \{ \}; \}\> | `object` | - |
|
|
133
|
+
| `G` *extends* [`GunshiParams`](../interfaces/GunshiParams.md)\<\{ `args`: [`Args`](../interfaces/Args.md); `extensions`: \{ \}; \}\> | [`DefaultGunshiParams`](../type-aliases/DefaultGunshiParams.md) | A type extending [`GunshiParams`](../interfaces/GunshiParams.md) to specify the shape of command and cli options. |
|
|
131
134
|
|
|
132
135
|
### Parameters
|
|
133
136
|
|
|
@@ -146,7 +149,7 @@ A rendered usage or undefined. if you will use [`CliOptions.usageSilent`](../int
|
|
|
146
149
|
## Call Signature
|
|
147
150
|
|
|
148
151
|
```ts
|
|
149
|
-
function cli
|
|
152
|
+
function cli(
|
|
150
153
|
args,
|
|
151
154
|
entry,
|
|
152
155
|
options?): Promise<string | undefined>;
|
|
@@ -154,19 +157,21 @@ options?): Promise<string | undefined>;
|
|
|
154
157
|
|
|
155
158
|
Run the command.
|
|
156
159
|
|
|
157
|
-
|
|
160
|
+
This overload accepts any command-like object using a loose structural type.
|
|
161
|
+
It bypasses TypeScript contravariance issues with callback properties.
|
|
158
162
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
Note: This overload MUST be last in the overload list. TypeScript checks overloads
|
|
164
|
+
in declaration order and selects the first matching one. The SubCommandable type
|
|
165
|
+
is intentionally loose and would match any command, so placing it first would
|
|
166
|
+
prevent proper type inference for more specific command types.
|
|
162
167
|
|
|
163
168
|
### Parameters
|
|
164
169
|
|
|
165
170
|
| Parameter | Type | Description |
|
|
166
171
|
| ------ | ------ | ------ |
|
|
167
172
|
| `args` | `string`[] | Command line arguments |
|
|
168
|
-
| `entry` |
|
|
169
|
-
| `options?` | [`CliOptions`](../interfaces/CliOptions.md)
|
|
173
|
+
| `entry` | [`SubCommandable`](../interfaces/SubCommandable.md) | A command-like object (command, command runner, or lazy command) |
|
|
174
|
+
| `options?` | [`CliOptions`](../interfaces/CliOptions.md)\<[`DefaultGunshiParams`](../type-aliases/DefaultGunshiParams.md)\> | A [CLI options](../interfaces/CliOptions.md) |
|
|
170
175
|
|
|
171
176
|
### Returns
|
|
172
177
|
|