gunshi 0.3.1 → 0.5.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.
- package/README.md +25 -12
- package/lib/context.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/{types.d-00BVt8hZ.d.ts → types.d-veidyA82.d.ts} +2 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -6,15 +6,12 @@
|
|
|
6
6
|
[![Version][npm-version-src]][npm-version-href]
|
|
7
7
|
[![CI][ci-src]][ci-href]
|
|
8
8
|
[![InstallSize][install-size-src]][install-size-src]
|
|
9
|
-
|
|
10
|
-
<!--
|
|
11
9
|
[![JSR][jsr-src]][jsr-href]
|
|
12
|
-
-->
|
|
13
10
|
|
|
14
11
|
Gunshi is a modern javascript command-line library
|
|
15
12
|
|
|
16
13
|
> [!TIP]
|
|
17
|
-
> gunshi (軍師) is a position in ancient Japanese samurai battle in which a
|
|
14
|
+
> gunshi (軍師) is a position in ancient Japanese samurai battle in which a samurai devised strategies and gave orders. That name is inspired by the word "command".
|
|
18
15
|
|
|
19
16
|
## ✨ Features
|
|
20
17
|
|
|
@@ -42,9 +39,21 @@ pnpm add gunshi
|
|
|
42
39
|
yarn add gunshi
|
|
43
40
|
```
|
|
44
41
|
|
|
42
|
+
### 🦕 Deno
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
deno add jsr:@kazupon/gunshi
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 🥟 Bun
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
bun add gunshi
|
|
52
|
+
```
|
|
53
|
+
|
|
45
54
|
## 🚀 Usage
|
|
46
55
|
|
|
47
|
-
### Simple API
|
|
56
|
+
### 📏 Simple API
|
|
48
57
|
|
|
49
58
|
Gunshi has a simple API that is a facade:
|
|
50
59
|
|
|
@@ -57,7 +66,7 @@ cli(process.argv.slice(2), () => {
|
|
|
57
66
|
})
|
|
58
67
|
```
|
|
59
68
|
|
|
60
|
-
### Type-Safe Arguments
|
|
69
|
+
### 🛡️ Type-Safe Arguments
|
|
61
70
|
|
|
62
71
|
Gunshi provides type-safe argument parsing with TypeScript:
|
|
63
72
|
|
|
@@ -97,7 +106,7 @@ await cli(process.argv.slice(2), command)
|
|
|
97
106
|
|
|
98
107
|
For more detailed examples, check out the [playground/type-safe](https://github.com/kazupon/gunshi/tree/main/playground/type-safe) in the repository.
|
|
99
108
|
|
|
100
|
-
### Declarative Configuration
|
|
109
|
+
### ⚙️ Declarative Configuration
|
|
101
110
|
|
|
102
111
|
Configure commands declaratively:
|
|
103
112
|
|
|
@@ -137,7 +146,7 @@ cli(process.argv.slice(2), command, {
|
|
|
137
146
|
|
|
138
147
|
For more detailed examples, check out the [playground/declarative](https://github.com/kazupon/gunshi/tree/main/playground/declarative) in the repository.
|
|
139
148
|
|
|
140
|
-
### Composable Sub-commands
|
|
149
|
+
### 🧩 Composable Sub-commands
|
|
141
150
|
|
|
142
151
|
Create a CLI with composable sub-commands:
|
|
143
152
|
|
|
@@ -188,7 +197,7 @@ cli(process.argv.slice(2), mainCommand, {
|
|
|
188
197
|
|
|
189
198
|
For more detailed examples, check out the [playground/composable](https://github.com/kazupon/gunshi/tree/main/playground/composable) in the repository.
|
|
190
199
|
|
|
191
|
-
### Lazy & Async Command Loading
|
|
200
|
+
### ⏳ Lazy & Async Command Loading
|
|
192
201
|
|
|
193
202
|
Load commands lazily and execute them asynchronously:
|
|
194
203
|
|
|
@@ -229,7 +238,7 @@ cli(
|
|
|
229
238
|
|
|
230
239
|
For more detailed examples, check out the [playground/lazy-async](https://github.com/kazupon/gunshi/tree/main/playground/lazy-async) in the repository.
|
|
231
240
|
|
|
232
|
-
### Auto Usage Generation
|
|
241
|
+
### 📜 Auto Usage Generation
|
|
233
242
|
|
|
234
243
|
Gunshi automatically generates usage information:
|
|
235
244
|
|
|
@@ -266,7 +275,7 @@ cli(process.argv.slice(2), command, {
|
|
|
266
275
|
|
|
267
276
|
For more detailed examples, check out the [playground/auto-usage](https://github.com/kazupon/gunshi/tree/main/playground/auto-usage) in the repository.
|
|
268
277
|
|
|
269
|
-
### Custom Usage Generation
|
|
278
|
+
### 🎨 Custom Usage Generation
|
|
270
279
|
|
|
271
280
|
Customize the usage message generation:
|
|
272
281
|
|
|
@@ -316,7 +325,7 @@ cli(
|
|
|
316
325
|
|
|
317
326
|
For more detailed examples, check out the [playground/custom-usage](https://github.com/kazupon/gunshi/tree/main/playground/custom-usage) in the repository.
|
|
318
327
|
|
|
319
|
-
### Internationalization
|
|
328
|
+
### 🌍 Internationalization
|
|
320
329
|
|
|
321
330
|
Support internationalization:
|
|
322
331
|
|
|
@@ -359,6 +368,10 @@ cli(process.argv.slice(2), command, {
|
|
|
359
368
|
|
|
360
369
|
For more detailed examples, check out the [playground/i18n](https://github.com/kazupon/gunshi/tree/main/playground/i18n) in the repository.
|
|
361
370
|
|
|
371
|
+
## 💁♀️ Showcases
|
|
372
|
+
|
|
373
|
+
- [pnpmc](https://github.com/kazupon/pnpmc): PNPM Catalogs Tooling
|
|
374
|
+
|
|
362
375
|
## 🙌 Contributing guidelines
|
|
363
376
|
|
|
364
377
|
If you are interested in contributing to `gunshi`, I highly recommend checking out [the contributing guidelines](/CONTRIBUTING.md) here. You'll find all the relevant information such as [how to make a PR](/CONTRIBUTING.md#pull-request-guidelines), [how to setup development](/CONTRIBUTING.md#development-setup)) etc., there.
|
package/lib/context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ArgOptions, ArgValues } from 'args-tokens';
|
|
2
|
-
import { C as Command, a as CommandOptions, b as CommandContext } from './types.d-
|
|
2
|
+
import { C as Command, a as CommandOptions, b as CommandContext } from './types.d-veidyA82.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The default locale string, which format is BCP 47 language tag
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArgOptions } from 'args-tokens';
|
|
2
2
|
export { ArgOptionSchema, ArgOptions, ArgValues } from 'args-tokens';
|
|
3
|
-
import { C as Command, c as CommandRunner, a as CommandOptions } from './types.d-
|
|
4
|
-
export { f as CommandBuiltinKeys, d as CommandBuiltinOptionsKeys, e as CommandBuiltinResourceKeys, b as CommandContext, g as CommandEnvironment, h as CommandResource, i as CommandResourceFetcher, L as LazyCommand } from './types.d-
|
|
3
|
+
import { C as Command, c as CommandRunner, a as CommandOptions } from './types.d-veidyA82.js';
|
|
4
|
+
export { f as CommandBuiltinKeys, d as CommandBuiltinOptionsKeys, e as CommandBuiltinResourceKeys, b as CommandContext, g as CommandEnvironment, h as CommandResource, i as CommandResourceFetcher, L as LazyCommand } from './types.d-veidyA82.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Run the command
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ArgOptions, ArgValues } from 'args-tokens';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type CommonOptionType = {
|
|
4
4
|
readonly help: {
|
|
5
5
|
readonly type: "boolean"
|
|
6
6
|
readonly short: "h"
|
|
@@ -10,6 +10,7 @@ declare const COMMON_OPTIONS: {
|
|
|
10
10
|
readonly short: "v"
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
+
declare const COMMON_OPTIONS: CommonOptionType;
|
|
13
14
|
declare const COMMAND_OPTIONS_DEFAULT: CommandOptions<ArgOptions>;
|
|
14
15
|
declare const COMMAND_I18N_RESOURCE_KEYS: readonly ["USAGE", "COMMAND", "SUBCOMMAND", "COMMANDS", "OPTIONS", "EXAMPLES", "FORMORE"];
|
|
15
16
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gunshi",
|
|
3
3
|
"description": "Modern javascript command-line library",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
7
7
|
"email": "kawakazu80@gmail.com"
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"eslint-plugin-unicorn": "^57.0.0",
|
|
85
85
|
"eslint-plugin-yml": "^1.17.0",
|
|
86
86
|
"gh-changelogen": "^0.2.8",
|
|
87
|
+
"jsr": "^0.13.4",
|
|
87
88
|
"knip": "^5.45.0",
|
|
88
89
|
"lint-staged": "^15.4.3",
|
|
89
90
|
"pkg-pr-new": "^0.0.41",
|
|
@@ -119,6 +120,7 @@
|
|
|
119
120
|
"fix:prettier": "prettier . --write",
|
|
120
121
|
"lint": "pnpm run --stream --color \"/^lint:/\"",
|
|
121
122
|
"lint:eslint": "eslint .",
|
|
123
|
+
"lint:jsr": "jsr publish --dry-run --allow-dirty",
|
|
122
124
|
"lint:knip": "knip",
|
|
123
125
|
"lint:prettier": "prettier . --check",
|
|
124
126
|
"release": "bumpp --commit \"release: v%s\" --all --push --tag",
|