@crustjs/core 0.0.18 → 0.0.19
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 +14 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,15 +16,15 @@ bun add @crustjs/core
|
|
|
16
16
|
import { Crust } from "@crustjs/core";
|
|
17
17
|
|
|
18
18
|
const app = new Crust("greet")
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
.meta({ description: "Say hello" })
|
|
20
|
+
.args([{ name: "name", type: "string", default: "world" }] as const)
|
|
21
|
+
.flags({
|
|
22
|
+
loud: { type: "boolean", description: "Shout it", alias: "l" },
|
|
23
|
+
})
|
|
24
|
+
.run(({ args, flags }) => {
|
|
25
|
+
const msg = `Hello, ${args.name}!`;
|
|
26
|
+
console.log(flags.loud ? msg.toUpperCase() : msg);
|
|
27
|
+
});
|
|
28
28
|
|
|
29
29
|
app.execute();
|
|
30
30
|
```
|
|
@@ -33,12 +33,12 @@ app.execute();
|
|
|
33
33
|
|
|
34
34
|
Flags and positional arguments support six built-in `type` literals:
|
|
35
35
|
|
|
36
|
-
- `"string"`
|
|
37
|
-
- `"number"`
|
|
36
|
+
- `"string"` — raw string token
|
|
37
|
+
- `"number"` — coerced via `Number(raw)`
|
|
38
38
|
- `"boolean"` — toggle (`--flag` / `--no-flag`)
|
|
39
|
-
- `"url"`
|
|
40
|
-
- `"path"`
|
|
41
|
-
- `"json"`
|
|
39
|
+
- `"url"` — `new URL(raw)` → `URL` instance
|
|
40
|
+
- `"path"` — `~` expanded, resolved to an absolute `string`
|
|
41
|
+
- `"json"` — `JSON.parse(raw)` → `unknown`
|
|
42
42
|
|
|
43
43
|
For formats that aren't built in, attach a synchronous `parse` to a `type: "string"` flag or arg. The inferred type flows from `ReturnType<parse>`:
|
|
44
44
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crustjs/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "Core library for the Crust CLI framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"publish": "bun publish --no-git-checks || true"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@crustjs/utils": "0.0.
|
|
45
|
+
"@crustjs/utils": "0.0.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@crustjs/config": "0.0.0",
|