create-crust 0.0.31 → 0.2.1
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/LICENSE +21 -0
- package/README.md +26 -7
- package/dist/index.js +2 -5
- package/package.json +16 -11
- package/templates/distribution/binary/package.json +2 -2
- package/templates/distribution/runtime/package.json +2 -2
- package/templates/minimal/README.md +1 -1
- package/templates/minimal/src/cli.ts +17 -22
- package/templates/modular/README.md +0 -42
- package/templates/modular/src/app.ts +0 -11
- package/templates/modular/src/cli.ts +0 -7
- package/templates/modular/src/commands/greet.ts +0 -16
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chenxin Yan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,19 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# create-crust
|
|
2
2
|
|
|
3
3
|
Scaffold a new [Crust](https://crustjs.com) CLI project in seconds.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
|
|
8
|
+
npm create crust@latest my-cli
|
|
9
|
+
# or
|
|
10
|
+
pnpm create crust@latest my-cli
|
|
11
|
+
# or
|
|
12
|
+
bunx create-crust@latest my-cli
|
|
13
|
+
# or
|
|
14
|
+
bun create crust@latest my-cli
|
|
15
|
+
# or
|
|
16
|
+
deno run -A npm:create-crust@latest my-cli
|
|
9
17
|
```
|
|
10
18
|
|
|
11
|
-
|
|
19
|
+
The initializer collects the destination, any required overwrite decision, distribution mode, dependency installation choice, and Git initialization choice. Explicit flags skip the corresponding prompts; prompts can also use defaults without rendering non-interactively. The package name is inferred from the directory name.
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
## Options
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
-
|
|
23
|
+
```text
|
|
24
|
+
create-crust [directory] [--distribution binary|runtime] [--install|--no-install] [--git|--no-git] [--overwrite|--no-overwrite]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- `directory` sets the destination; otherwise the directory prompt defaults to `my-cli`.
|
|
28
|
+
- `--distribution` selects `binary` for standalone executables or `runtime` for a JavaScript build run with Bun. The default is `binary`.
|
|
29
|
+
- `--install` / `--no-install` installs or skips dependencies. The default is to install.
|
|
30
|
+
- `--git` / `--no-git` initializes or skips a Git repository when the destination is not already inside one. The default is to initialize.
|
|
31
|
+
- When the destination requires an overwrite decision, `--overwrite` overwrites conflicting files without confirmation; `--no-overwrite` aborts without prompting. The default is not to overwrite.
|
|
32
|
+
|
|
33
|
+
Generated projects use the single-file starter (`src/cli.ts`).
|
|
17
34
|
|
|
18
35
|
Every generated project includes:
|
|
19
36
|
|
|
@@ -39,7 +56,9 @@ The binary templates intentionally keep `build` and `package` as separate script
|
|
|
39
56
|
|
|
40
57
|
If you need public build-time constants, `crust build` can use Bun's cwd env by default or explicit `--env-file` inputs.
|
|
41
58
|
|
|
42
|
-
> **Note:**
|
|
59
|
+
> **Note:** Binary projects use a top-level `bin` entry at `dist/cli` for local development. `crust build --package` generates staged packages in `dist/npm/`, each with its own platform-appropriate `files` and `bin` entries; those staged manifests are used for binary npm distribution. The generated binary template's own `files` list excludes Extension artifact directories; use the staged packages to include them.
|
|
60
|
+
|
|
61
|
+
Bun runtime projects use `bun build src/cli.ts --target bun --outfile dist/cli.js` and run the result with `bun run dist/cli.js`. This separate workflow does not use `crust build --runtime node`, snapshot preparation, or Extension build hooks.
|
|
43
62
|
|
|
44
63
|
## Documentation
|
|
45
64
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
|
|
3
|
-
import{existsSync as x}from"fs";import{basename as Y,resolve as j}from"path";import{Crust as Z}from"@crustjs/core";import{isInGitRepo as $,runSteps as m}from"@crustjs/create";import{spinner as g}from"@crustjs/progress";import{confirm as y,input as F,select as C}from"@crustjs/prompts";import{runSteps as R,scaffold as n}from"@crustjs/create";var w={name:"@crustjs/core",version:"0.0.19",description:"Core library for the Crust CLI framework",type:"module",license:"MIT",author:"chenxin-yan",repository:{type:"git",url:"git+https://github.com/chenxin-yan/crust.git",directory:"packages/core"},homepage:"https://crustjs.com",bugs:{url:"https://github.com/chenxin-yan/crust/issues"},keywords:["cli","command","framework","parser","bun","typescript"],files:["dist"],exports:{".":{import:"./dist/index.js",types:"./dist/index.d.ts"}},publishConfig:{access:"public"},scripts:{build:"bunup",dev:"bunup --watch","check:types":"tsc --noEmit",test:"bun test",publish:"bun publish --no-git-checks || true"},dependencies:{"@crustjs/utils":"workspace:*"},devDependencies:{"@crustjs/config":"workspace:*",bunup:"catalog:"},peerDependencies:{typescript:"catalog:"}};var k={name:"@crustjs/crust",version:"0.0.24",description:"CLI tooling for the Crust framework",type:"module",license:"MIT",author:"chenxin-yan",repository:{type:"git",url:"git+https://github.com/chenxin-yan/crust.git",directory:"packages/crust"},homepage:"https://crustjs.com",bugs:{url:"https://github.com/chenxin-yan/crust/issues"},keywords:["cli","build","compile","standalone","bun","typescript"],files:["dist/cli","dist/cli.cmd","dist/*-bun-*"],publishConfig:{access:"public"},bin:{crust:"dist/cli"},scripts:{build:"bunup && bun dist/cli.js build --package --entry src/cli.ts --name crust","build:dev":"bunup && bun dist/cli.js build --entry src/cli.ts --name crust",publish:"bun dist/cli.js publish --stage-dir dist/npm || true",dev:"bun ./src/cli.ts",start:"./dist/cli","check:types":"tsc --noEmit",test:"bun test"},devDependencies:{"@crustjs/man":"workspace:*","@crustjs/core":"workspace:*","@crustjs/plugins":"workspace:*","@crustjs/style":"workspace:*","@crustjs/config":"workspace:*",bunup:"catalog:"},peerDependencies:{typescript:"catalog:"}};var e={name:"@crustjs/plugins",version:"0.1.2",description:"Official plugins for the Crust CLI framework",type:"module",license:"MIT",author:"chenxin-yan",repository:{type:"git",url:"git+https://github.com/chenxin-yan/crust.git",directory:"packages/plugins"},homepage:"https://crustjs.com",bugs:{url:"https://github.com/chenxin-yan/crust/issues"},keywords:["cli","plugin","help","version","did-you-mean","man","bun","typescript"],files:["dist"],exports:{".":{import:"./dist/index.js",types:"./dist/index.d.ts"}},publishConfig:{access:"public"},scripts:{build:"bunup",dev:"bunup --watch","check:types":"tsc --noEmit",test:"bun test",publish:"bun publish --no-git-checks || true"},dependencies:{"@crustjs/style":"workspace:*"},devDependencies:{"@crustjs/config":"workspace:*","@crustjs/core":"workspace:*",bunup:"catalog:"},peerDependencies:{"@crustjs/core":"workspace:*",typescript:"catalog:"}};var W={crustCoreVersion:w.version,crustPluginsVersion:e.version,crustCliVersion:k.version};async function o(c){let{resolvedDir:s,name:t,template:u,distributionMode:p}=c,h=u==="minimal"?"templates/minimal":"templates/modular",b=p==="binary"?"templates/distribution/binary":"templates/distribution/runtime",i={name:t,...W};await n({template:"templates/base",dest:s,context:i}),await n({template:h,dest:s,context:i,conflict:"overwrite"}),await n({template:b,dest:s,context:i,conflict:"overwrite"})}var H=/[<>:"|?*\\]/;function O(c){if(!c)throw Error("Project name cannot be empty");if(H.test(c))throw Error(`Project name contains invalid characters: ${c}`)}function U(c){if(c===void 0)return;if(c==="minimal"||c==="modular")return c;throw Error(`Invalid template "${c}". Expected "minimal" or "modular".`)}function X(c){if(c===void 0)return;if(c==="binary"||c==="runtime")return c;throw Error(`Invalid distribution "${c}". Expected "binary" or "runtime".`)}var E=new Z("create-crust").meta({description:"Scaffold a new Crust CLI project"}).flags({template:{type:"string",description:'Template style ("minimal" or "modular")'},distribution:{type:"string",description:'Distribution mode ("binary" or "runtime")'},install:{type:"boolean",description:"Install dependencies after scaffolding"},git:{type:"boolean",description:"Initialize a git repository after scaffolding"},overwrite:{type:"boolean",description:"Overwrite the destination directory if it already exists"}}).args([{name:"directory",type:"string",description:"Project directory to scaffold into"}]).run(async({args:c,flags:s})=>{let t=c.directory??await F({message:"Project directory",default:"my-cli",validate:O}),u=j(process.cwd(),t),p=Y(u),h=U(s.template),b=X(s.distribution);if(t!=="."&&x(u)){if(s.overwrite===!0)console.log(`Directory "${p}" already exists; overwriting (--overwrite).`);if(!await y({message:`Directory "${p}" already exists. Overwrite?`,default:!1,...s.overwrite!==void 0?{initial:s.overwrite}:{}})){console.log("Aborted.");return}}let i=await C({message:"Template style",choices:[{label:"Minimal",value:"minimal",hint:"single-file starter"},{label:"Modular",value:"modular",hint:"file split with .sub()"}],default:"minimal",...h!==void 0?{initial:h}:{}}),L=await C({message:"Distribution mode",choices:[{label:"Standalone binaries (recommended)",value:"binary",hint:"compile with crust build, publish self-contained executables"},{label:"Bun runtime package",value:"runtime",hint:"ship JS build that runs with Bun"}],default:"binary",...b!==void 0?{initial:b}:{}}),q=await y({message:"Install dependencies?",default:!0,...s.install!==void 0?{initial:s.install}:{}}),z=x(u)?u:j(u,".."),B=$(z)?!1:await y({message:"Initialize a git repository?",default:!0,...s.git!==void 0?{initial:s.git}:{}}),r=p;if(await g({message:"Scaffolding project...",task:()=>o({resolvedDir:u,name:r,template:i,distributionMode:L})}),q)await m([{type:"install"}],u);if(B)await g({message:"Initializing git repository...",task:()=>m([{type:"git-init",commit:"chore: initial commit"}],u)});if(console.log(`
|
|
4
|
-
Created ${r}!
|
|
5
|
-
`),console.log("Next steps:"),t!=="."){let d=t.startsWith("/")?t:`./${t}`;console.log(` cd ${d}`)}console.log(" bun run dev"),console.log(" bun run build")});await E.execute();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{existsSync as e,readdirSync as t}from"node:fs";import{basename as n,resolve as r}from"node:path";import{Crust as i}from"@crustjs/core";import{isInGitRepo as a,runSteps as o,scaffold as s}from"@crustjs/create";import{spinner as c}from"@crustjs/progress";import{confirm as l,input as u,select as d}from"@crustjs/prompts";const f={crustCoreVersion:`0.2.1`,crustExtensionsVersion:`0.2.1`,crustCliVersion:`0.2.1`},p=/[<>:"|?*\\]/;function m(e){if(!e)throw Error(`Project name cannot be empty`);if(p.test(e))throw Error(`Project name contains invalid characters: ${e}`)}await new i(`create-crust`,{description:`Scaffold a new Crust CLI project`}).flags({name:`distribution`,type:`string`,choices:[`binary`,`runtime`],description:`Distribution mode ("binary" or "runtime")`},{name:`install`,type:`boolean`,description:`Install dependencies after scaffolding`},{name:`git`,type:`boolean`,description:`Initialize a git repository after scaffolding`},{name:`overwrite`,type:`boolean`,description:`Overwrite the destination directory if it already exists`}).args({name:`directory`,type:`string`,description:`Project directory to scaffold into`}).action(async({args:i,flags:p})=>{let h=i.directory??await u({message:`Project directory`,default:`my-cli`,validate:m}),g=r(process.cwd(),h),_=n(g),v=p.distribution,y=h===`.`?t(g).length>0:e(g),b=!1;if(y&&(b=await l({message:h===`.`?`Current directory is not empty. Overwrite conflicting files?`:`Directory "${_}" already exists. Overwrite?`,default:!1,...p.overwrite===void 0?{}:{initial:p.overwrite}}),!b)){console.log(`Aborted.`);return}let x=await d({message:`Distribution mode`,choices:[{label:`Standalone binaries (recommended)`,value:`binary`,hint:`compile with crust build, publish self-contained executables`},{label:`Bun runtime package`,value:`runtime`,hint:`ship JS build that runs with Bun`}],default:`binary`,...v===void 0?{}:{initial:v}}),S=await l({message:`Install dependencies?`,default:!0,...p.install===void 0?{}:{initial:p.install}}),C=e(g)?g:r(g,`..`),w=!a(C)&&await l({message:`Initialize a git repository?`,default:!0,...p.git===void 0?{}:{initial:p.git}}),T=_,E=e=>new URL(`../templates/${e}`,import.meta.url),D={name:T,...f};if(await c({message:`Scaffolding project...`,task:async()=>{await s({template:E(`base`),dest:g,context:D,...b?{conflict:`overwrite`}:{}}),await s({template:E(`minimal`),dest:g,context:D,conflict:`overwrite`}),await s({template:E(`distribution/${x}`),dest:g,context:D,conflict:`overwrite`})}}),S&&await o([{type:`install`}],g),w&&await c({message:`Initializing git repository...`,task:()=>o([{type:`git-init`,commit:`chore: initial commit`}],g)}),console.log(`\nCreated ${T}!\n`),console.log(`Next steps:`),h!==`.`){let e=h.startsWith(`/`)?h:`./${h}`;console.log(` cd ${e}`)}console.log(` bun run dev`),console.log(` bun run build`)}).execute();export{};
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-crust",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Scaffold a new Crust CLI project.",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
6
7
|
"license": "MIT",
|
|
7
8
|
"author": "chenxin-yan",
|
|
8
9
|
"repository": {
|
|
@@ -34,24 +35,28 @@
|
|
|
34
35
|
"create-crust": "dist/index.js"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
|
-
"build": "
|
|
38
|
-
"dev": "
|
|
38
|
+
"build": "tsdown",
|
|
39
|
+
"dev": "tsdown --watch",
|
|
39
40
|
"check:types": "tsc --noEmit",
|
|
40
41
|
"test": "bun test",
|
|
41
42
|
"test:smoke": "bun test tests/cli.smoke.test.ts",
|
|
42
|
-
"
|
|
43
|
+
"prepack": "cp ../../LICENSE LICENSE",
|
|
44
|
+
"postpack": "rm -f LICENSE"
|
|
43
45
|
},
|
|
44
46
|
"dependencies": {
|
|
45
|
-
"@crustjs/core": "0.
|
|
46
|
-
"@crustjs/create": "0.
|
|
47
|
-
"@crustjs/progress": "0.
|
|
48
|
-
"@crustjs/prompts": "0.1
|
|
47
|
+
"@crustjs/core": "^0.2.1",
|
|
48
|
+
"@crustjs/create": "^0.1.1",
|
|
49
|
+
"@crustjs/progress": "^0.1.1",
|
|
50
|
+
"@crustjs/prompts": "^0.2.1"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
53
|
"@crustjs/config": "0.0.0",
|
|
52
|
-
"
|
|
54
|
+
"@crustjs/extensions": "0.2.1",
|
|
55
|
+
"tsdown": "^0.23.0"
|
|
53
56
|
},
|
|
54
|
-
"
|
|
55
|
-
"
|
|
57
|
+
"engines": {
|
|
58
|
+
"bun": ">=1.4.0",
|
|
59
|
+
"node": ">=22",
|
|
60
|
+
"deno": ">=2.8"
|
|
56
61
|
}
|
|
57
62
|
}
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@crustjs/core": "^{{crustCoreVersion}}",
|
|
24
24
|
"@crustjs/crust": "^{{crustCliVersion}}",
|
|
25
|
-
"@crustjs/
|
|
25
|
+
"@crustjs/extensions": "^{{crustExtensionsVersion}}",
|
|
26
26
|
"@types/bun": "latest",
|
|
27
|
-
"typescript": "^
|
|
27
|
+
"typescript": "^7.0.2"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@crustjs/core": "^{{crustCoreVersion}}",
|
|
21
|
-
"@crustjs/
|
|
21
|
+
"@crustjs/extensions": "^{{crustExtensionsVersion}}"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@crustjs/crust": "^{{crustCliVersion}}",
|
|
25
25
|
"@types/bun": "latest",
|
|
26
|
-
"typescript": "^
|
|
26
|
+
"typescript": "^7.0.2"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -18,7 +18,7 @@ bun run build
|
|
|
18
18
|
This template supports two distribution modes:
|
|
19
19
|
|
|
20
20
|
- **Standalone binaries (recommended)**: use `bun run build` for raw binaries, then `bun run package` for npm-ready staged packages.
|
|
21
|
-
- **Bun runtime package**: distribute with runtime dependencies (`@crustjs/core` and `@crustjs/
|
|
21
|
+
- **Bun runtime package**: distribute with runtime dependencies (`@crustjs/core` and `@crustjs/extensions` in `dependencies`).
|
|
22
22
|
|
|
23
23
|
## Publishing
|
|
24
24
|
|
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
import { Crust } from "@crustjs/core";
|
|
2
|
-
import {
|
|
2
|
+
import { help, version } from "@crustjs/extensions";
|
|
3
3
|
|
|
4
4
|
import pkg from "../package.json";
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
.
|
|
8
|
-
.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
description: "Your name",
|
|
15
|
-
default: "world",
|
|
16
|
-
},
|
|
17
|
-
])
|
|
6
|
+
const app = new Crust("{{name}}", { description: "A CLI built with Crust", version: pkg.version })
|
|
7
|
+
.extend(version(), help())
|
|
8
|
+
.args({
|
|
9
|
+
name: "name",
|
|
10
|
+
type: "string",
|
|
11
|
+
description: "Your name",
|
|
12
|
+
default: "world",
|
|
13
|
+
})
|
|
18
14
|
.flags({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
15
|
+
name: "greet",
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "Greeting to use",
|
|
18
|
+
default: "Hello",
|
|
19
|
+
short: "g",
|
|
25
20
|
})
|
|
26
|
-
.
|
|
27
|
-
|
|
21
|
+
.action(({ args, flags, stdout }) => {
|
|
22
|
+
stdout(`${flags.greet}, ${args.name}!`);
|
|
28
23
|
});
|
|
29
24
|
|
|
30
|
-
await
|
|
25
|
+
await app.execute();
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# {{name}}
|
|
2
|
-
|
|
3
|
-
A modular CLI built with [Crust](https://crustjs.com).
|
|
4
|
-
|
|
5
|
-
This template demonstrates the file-splitting pattern with `.sub()` and `.command(builder)`.
|
|
6
|
-
|
|
7
|
-
## Development
|
|
8
|
-
|
|
9
|
-
```sh
|
|
10
|
-
# Run in dev mode
|
|
11
|
-
bun run dev
|
|
12
|
-
|
|
13
|
-
# Type-check
|
|
14
|
-
bun run check:types
|
|
15
|
-
|
|
16
|
-
# Build distribution output
|
|
17
|
-
bun run build
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
This template supports two distribution modes:
|
|
21
|
-
|
|
22
|
-
- **Standalone binaries (recommended)**: use `bun run build` for raw binaries, then `bun run package` for npm-ready staged packages.
|
|
23
|
-
- **Bun runtime package**: distribute with runtime dependencies (`@crustjs/core` and `@crustjs/plugins` in `dependencies`).
|
|
24
|
-
|
|
25
|
-
## Publishing
|
|
26
|
-
|
|
27
|
-
- **Standalone binaries**:
|
|
28
|
-
`bun run build` produces raw binaries.
|
|
29
|
-
`bun run package` stages npm packages in `dist/npm/`.
|
|
30
|
-
`bun run publish` publishes the staged packages in manifest order.
|
|
31
|
-
- **Bun runtime package**: keep `bin` -> `dist/cli.js`, build with Bun (`bun build ... --outfile dist/cli.js`), and keep runtime deps in `dependencies`.
|
|
32
|
-
|
|
33
|
-
## Usage
|
|
34
|
-
|
|
35
|
-
```sh
|
|
36
|
-
# Run the greet subcommand
|
|
37
|
-
{{name}} greet world
|
|
38
|
-
{{name}} greet --greet Hey world
|
|
39
|
-
|
|
40
|
-
# Show help
|
|
41
|
-
{{name}} --help
|
|
42
|
-
```
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Crust } from "@crustjs/core";
|
|
2
|
-
|
|
3
|
-
export const app = new Crust("{{name}}").meta({ description: "A CLI built with Crust" }).flags({
|
|
4
|
-
greet: {
|
|
5
|
-
type: "string",
|
|
6
|
-
description: "Greeting to use",
|
|
7
|
-
default: "Hello",
|
|
8
|
-
short: "g",
|
|
9
|
-
inherit: true,
|
|
10
|
-
},
|
|
11
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { helpPlugin, versionPlugin } from "@crustjs/plugins";
|
|
2
|
-
|
|
3
|
-
import pkg from "../package.json";
|
|
4
|
-
import { app } from "./app.ts";
|
|
5
|
-
import { greetCmd } from "./commands/greet.ts";
|
|
6
|
-
|
|
7
|
-
await app.use(versionPlugin(pkg.version)).use(helpPlugin()).command(greetCmd).execute();
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { app } from "../app.ts";
|
|
2
|
-
|
|
3
|
-
export const greetCmd = app
|
|
4
|
-
.sub("greet")
|
|
5
|
-
.meta({ description: "Greet someone" })
|
|
6
|
-
.args([
|
|
7
|
-
{
|
|
8
|
-
name: "name",
|
|
9
|
-
type: "string",
|
|
10
|
-
description: "Your name",
|
|
11
|
-
default: "world",
|
|
12
|
-
},
|
|
13
|
-
])
|
|
14
|
-
.run(({ args, flags }) => {
|
|
15
|
-
console.log(`${flags.greet}, ${args.name}!`);
|
|
16
|
-
});
|