()
| 24 | #[cfg(not(feature = "markdown-docs"))] |
| 25 | #[tokio::main] |
| 26 | async fn main() -> anyhow::Result<ExitCode> { |
| 27 | use spacetimedb_paths::SpacetimePaths; |
| 28 | |
| 29 | // Compute matches before loading the config, because `Config` has an observable `drop` method |
| 30 | // (which deletes a lockfile), |
| 31 | // and Clap calls `exit` on parse failure rather than panicking, so destructors never run. |
| 32 | let matches = get_command().get_matches(); |
| 33 | let (cmd, subcommand_args) = matches.subcommand().unwrap(); |
| 34 | |
| 35 | let root_dir = matches.get_one::<RootDir>("root_dir"); |
| 36 | let paths = match root_dir { |
| 37 | Some(dir) => SpacetimePaths::from_root_dir(dir), |
| 38 | None => SpacetimePaths::platform_defaults()?, |
| 39 | }; |
| 40 | let cli_toml = matches |
| 41 | .get_one::<CliTomlPath>("config_path") |
| 42 | .cloned() |
| 43 | .unwrap_or_else(|| paths.cli_config_dir.cli_toml()); |
| 44 | let config = Config::load(cli_toml)?; |
| 45 | |
| 46 | exec_subcommand(config, &paths, root_dir, cmd, subcommand_args) |
| 47 | .await |
| 48 | .or_else(|e| e.downcast::<ExitWithCode>().map(|e| e.0)) |
| 49 | } |
| 50 | |
| 51 | #[cfg(feature = "markdown-docs")] |
| 52 | #[tokio::main] |
nothing calls this directly
no test coverage detected
searching dependent graphs…