| 28 | |
| 29 | impl Args { |
| 30 | pub fn exec(self) -> anyhow::Result<ExitCode> { |
| 31 | let paths = match &self.root_dir { |
| 32 | Some(root_dir) => SpacetimePaths::from_root_dir(root_dir), |
| 33 | None => SpacetimePaths::platform_defaults()?, |
| 34 | }; |
| 35 | match self.cmd { |
| 36 | Subcommand::Cli { args: mut cli_args } => { |
| 37 | if let Some(root_dir) = &self.root_dir { |
| 38 | cli_args.insert(0, OsString::from_iter(["--root-dir=".as_ref(), root_dir.as_ref()])); |
| 39 | } |
| 40 | crate::proxy::run_cli(Some(&paths), None, cli_args) |
| 41 | } |
| 42 | Subcommand::Version(version) => version.exec(&paths).map(|()| ExitCode::SUCCESS), |
| 43 | Subcommand::SelfInstall(self_install) => self_install.exec(), |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | #[derive(clap::Subcommand)] |