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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
use std::path::PathBuf;
use std::ffi::OsString;
use clap::{Args, Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(name = "teaql", version, about = "TeaQL toolchain", disable_help_subcommand = true)]
pub struct Cli {
#[arg(long, global = true, default_value = ".")]
pub cwd: PathBuf,
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Debug, Subcommand)]
pub enum Commands {
/// Show effective local config.
ShowConfig,
/// Configure TeaQL in the current workspace.
Config,
/// Ping the TeaQL service.
Ping(ServiceArgs),
/// Install symlink aliases for cargo-style command names.
InstallLinks(InstallLinksArgs),
/// Evaluate a KSML model input and report diagnostics.
Eval(EvalArgs),
/// Run cargo check and map any compiler errors back to the source KSML (XML) file.
Check(CheckArgs),
#[command(external_subcommand)]
Dynamic(Vec<OsString>),
}
#[derive(Debug, Parser)]
#[command(no_binary_name = true)]
pub struct DynamicArgs {
/// Additional path segments for the dynamic endpoint
#[arg(trailing_var_arg = true, allow_hyphen_values = false)]
pub paths: Vec<String>,
/// The input model file or directory (defaults to current directory if not specified)
#[arg(long)]
pub input: Option<PathBuf>,
/// Override TeaQL endpoint prefix.
#[arg(long)]
pub endpoint_prefix: Option<String>,
/// Override TeaQL service URL. Deprecated: use --endpoint-prefix.
#[arg(long)]
pub service_url: Option<String>,
/// Override API Key.
#[arg(long)]
pub api_key: Option<String>,
/// Override output directory.
#[arg(long)]
pub output: Option<PathBuf>,
/// Override request timeout in seconds.
#[arg(long)]
pub timeout_seconds: Option<u64>,
}
#[derive(Debug, Args)]
pub struct CheckArgs {
/// Pass additional arguments to cargo check (e.g. --workspace, --tests).
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
pub cargo_args: Vec<String>,
}
#[derive(Debug, Args)]
pub struct EvalArgs {
/// Model file, directory, or zip to evaluate.
pub input: PathBuf,
/// Server base URL. Defaults to the configured TeaQL API URL.
#[arg(long, alias = "server")]
pub endpoint_prefix: Option<String>,
/// Override TeaQL service URL. Deprecated: use --endpoint-prefix.
#[arg(long)]
pub service_url: Option<String>,
/// Write the raw Markdown report to a file.
#[arg(long)]
pub output: Option<PathBuf>,
/// Exit non-zero when warnings exist.
#[arg(long)]
pub fail_on_warning: bool,
/// Override request timeout in seconds.
#[arg(long)]
pub timeout_seconds: Option<u64>,
}
#[derive(Debug, Args)]
pub struct GenerateArgs {
/// Model file or directory to upload.
pub input: PathBuf,
/// Override TeaQL endpoint prefix, for example https://api.teaql.io/latest/.
#[arg(long)]
pub endpoint_prefix: Option<String>,
/// Override TeaQL service URL. Deprecated: use --endpoint-prefix.
#[arg(long)]
pub service_url: Option<String>,
/// Override API Key. (Default: Built-in free tier OOTB key)
#[arg(long)]
pub api_key: Option<String>,
/// Override output directory.
#[arg(long)]
pub output: Option<PathBuf>,
/// Override request timeout in seconds.
#[arg(long)]
pub timeout_seconds: Option<u64>,
}
#[derive(Debug, Args)]
pub struct GenServiceArgs {
#[command(flatten)]
pub generate_args: GenerateArgs,
/// The target service to generate (e.g. rust-app-console)
#[arg(long, short = 's')]
pub service: String,
}
#[derive(Debug, Args)]
pub struct ServiceArgs {
/// Override TeaQL endpoint prefix, for example https://api.teaql.io/latest/.
#[arg(long)]
pub endpoint_prefix: Option<String>,
/// Override TeaQL service URL. Deprecated: use --endpoint-prefix.
#[arg(long)]
pub service_url: Option<String>,
/// Override API Key. (Default: Built-in free tier OOTB key)
#[arg(long)]
pub api_key: Option<String>,
/// Override request timeout in seconds.
#[arg(long)]
pub timeout_seconds: Option<u64>,
}
#[derive(Debug, Args)]
pub struct InstallLinksArgs {
/// Directory where symlinks should be created. Defaults to the current executable directory.
#[arg(long)]
pub dir: Option<PathBuf>,
/// Replace existing files or symlinks when needed.
#[arg(long)]
pub force: bool,
}