Skip to content

Commit 86d234d

Browse files
committed
Update getbox version
1 parent 14436e9 commit 86d234d

3 files changed

Lines changed: 13 additions & 17 deletions

File tree

README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import { arg, singleProgram, flag } from "commandstruct";
5656

5757
const prog = singleProgram("mycat")
5858
.describe("print contents of file to stdout")
59-
.args({
59+
.args({
6060
file: arg(),
6161
})
6262
.flags({
@@ -67,7 +67,7 @@ const prog = singleProgram("mycat")
6767
"printing contents of file",
6868
args.file,
6969
flags.n ? "with lines" : "without lines",
70-
restArgs
70+
restArgs,
7171
);
7272
});
7373

@@ -354,11 +354,7 @@ class Logger {
354354
class UserService {
355355
constructor(private logger: Logger) {}
356356

357-
static init(box: Box) {
358-
// Called automatically when box.get(UserService) is used
359-
const logger = box.get(Logger);
360-
return new UserService(logger);
361-
}
357+
static init = Box.init(UserService).get(Logger);
362358

363359
createUser(name: string) {
364360
this.logger.log(`Creating user: ${name}`);
@@ -373,10 +369,10 @@ const createCmd = command("create")
373369
service.createUser(args.name);
374370
});
375371

376-
// The program creates a default box automatically
372+
// The program creates a default Box instance
377373
const prog = program("user-utils").commands(createCmd).build();
378374

379-
// Or you can provide your own box
375+
// You can provide your own Box instance
380376
const box = new Box();
381377
const prog2 = program("user-utils", box).commands(createCmd).build();
382378
```
@@ -407,7 +403,7 @@ run(
407403
console.error(err);
408404
},
409405
},
410-
process.argv
406+
process.argv,
411407
);
412408
```
413409

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "commandstruct",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "Type safe and modular CLIs with Sade",
55
"private": false,
66
"main": "./dist/index.cjs",
@@ -51,7 +51,7 @@
5151
"vitest": "^4.0.16"
5252
},
5353
"peerDependencies": {
54-
"getbox": ">= 1.0.0 <2.0.0",
54+
"getbox": ">= 1.4.0 <2.0.0",
5555
"sade": ">= 1.8.1"
5656
}
5757
}

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)