1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
use clap::builder::PossibleValuesParser;
use clap::{Parser, Subcommand};
use crate::{cmd_add, cmd_create};
#[derive(Parser)]
#[command(name = "matcha", version, about = "green-tea CLI")]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(Subcommand)]
pub enum Command {
/// Scaffold a new project
New {
name: String,
#[arg(long)]
template_url: Option<String>,
#[arg(long, default_value = "node", value_parser = ["node", "deno", "bun", "edge"])]
runtime: String,
},
/// Detect the runtime and run the project in watch mode
Run,
/// Generate a piece and auto-wire it into the module
Create {
#[arg(value_parser = PossibleValuesParser::new(cmd_create::kinds()))]
kind: String,
name: String,
#[arg(long)]
check: bool,
},
/// Check the project for the misconfigurations that fail confusingly
Doctor,
/// Print the dependency graph (Mermaid, DOT, or JSON)
Graph {
#[arg(long, default_value = "mermaid", value_parser = ["mermaid", "dot", "json"])]
format: String,
/// Entry file exporting `app` (default: src/app.ts, then src/main.ts)
#[arg(long)]
entry: Option<String>,
/// Write to this file instead of stdout
#[arg(long)]
out: Option<String>,
},
/// Print the structural OpenAPI 3.1 document for the route table
Openapi {
/// API title (default: core's own)
#[arg(long)]
title: Option<String>,
/// API version (default: core's own)
#[arg(long)]
api_version: Option<String>,
#[arg(long)]
entry: Option<String>,
#[arg(long)]
out: Option<String>,
},
/// Explain one route's chain, in execution order
Explain {
/// The route pattern as declared, e.g. /users/:id
route: String,
#[arg(long)]
entry: Option<String>,
#[arg(long)]
out: Option<String>,
},
/// Add a capability to a controller
Add {
#[arg(value_parser = PossibleValuesParser::new(cmd_add::names()))]
capability: String,
/// Which controller to edit (default: the only one in src/controllers)
#[arg(long)]
controller: Option<String>,
},
}