MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / cli

Function cli

crates/cli/src/subcommands/init.rs:157–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155}
156
157pub fn cli() -> clap::Command {
158 clap::Command::new("init")
159 .about("Initializes a new spacetime project.")
160 .arg(
161 Arg::new("project-path")
162 .long("project-path")
163 .value_name("PATH")
164 .value_parser(clap::value_parser!(PathBuf))
165 .help("Directory where the project will be created (defaults to `./<PROJECT_NAME>`)"),
166 )
167 .arg(Arg::new("project-name").value_name("PROJECT_NAME").help("Project name"))
168 .arg(
169 Arg::new("server-only")
170 .long("server-only")
171 .help("Initialize server only from the template (no client)")
172 .action(clap::ArgAction::SetTrue),
173 )
174 .arg(Arg::new("lang").long("lang").value_name("LANG").help(
175 "Server language: rust, csharp, typescript, cpp (it can only be used when --template is not specified)",
176 ))
177 .arg(
178 Arg::new("template")
179 .short('t')
180 .long("template")
181 .value_name("TEMPLATE")
182 .num_args(0..=1)
183 .default_missing_value("")
184 .help("Template ID or GitHub repository (owner/repo or URL)"),
185 )
186 .arg(
187 Arg::new("local")
188 .long("local")
189 .action(clap::ArgAction::SetTrue)
190 .help("Use local deployment instead of Maincloud"),
191 )
192 .arg(
193 Arg::new("non-interactive")
194 .long("non-interactive")
195 .action(clap::ArgAction::SetTrue)
196 .help("Run in non-interactive mode"),
197 )
198 .arg(
199 Arg::new("native-aot")
200 .long("native-aot")
201 .action(clap::ArgAction::SetTrue)
202 .help("Configure C# project for NativeAOT-LLVM compilation (experimental, Windows only)"),
203 )
204}
205
206pub async fn fetch_templates_list() -> anyhow::Result<Vec<TemplateDefinition>> {
207 let content = embedded::get_templates_json();

Callers

nothing calls this directly

Calls 1

newFunction · 0.50

Tested by

no test coverage detected