diff options
Diffstat (limited to 'xtask/src/main.rs')
-rw-r--r-- | xtask/src/main.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 3f4aa5497..536a67047 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs | |||
@@ -12,12 +12,12 @@ use std::env; | |||
12 | 12 | ||
13 | use codegen::CodegenCmd; | 13 | use codegen::CodegenCmd; |
14 | use pico_args::Arguments; | 14 | use pico_args::Arguments; |
15 | use xshell::pushd; | ||
15 | use xtask::{ | 16 | use xtask::{ |
16 | codegen::{self, Mode}, | 17 | codegen::{self, Mode}, |
17 | dist::DistCmd, | 18 | dist::DistCmd, |
18 | install::{ClientOpt, InstallCmd, Malloc, ServerOpt}, | 19 | install::{InstallCmd, Malloc, ServerOpt}, |
19 | metrics::MetricsCmd, | 20 | metrics::MetricsCmd, |
20 | not_bash::pushd, | ||
21 | pre_cache::PreCacheCmd, | 21 | pre_cache::PreCacheCmd, |
22 | pre_commit, project_root, | 22 | pre_commit, project_root, |
23 | release::{PromoteCmd, ReleaseCmd}, | 23 | release::{PromoteCmd, ReleaseCmd}, |
@@ -29,7 +29,7 @@ fn main() -> Result<()> { | |||
29 | return pre_commit::run_hook(); | 29 | return pre_commit::run_hook(); |
30 | } | 30 | } |
31 | 31 | ||
32 | let _d = pushd(project_root()); | 32 | let _d = pushd(project_root())?; |
33 | 33 | ||
34 | let mut args = Arguments::from_env(); | 34 | let mut args = Arguments::from_env(); |
35 | let subcommand = args.subcommand()?.unwrap_or_default(); | 35 | let subcommand = args.subcommand()?.unwrap_or_default(); |
@@ -46,19 +46,20 @@ USAGE: | |||
46 | cargo xtask install [FLAGS] | 46 | cargo xtask install [FLAGS] |
47 | 47 | ||
48 | FLAGS: | 48 | FLAGS: |
49 | --client-code Install only VS Code plugin | 49 | --client[=CLIENT] Install only VS Code plugin. |
50 | --server Install only the language server | 50 | CLIENT is one of 'code', 'code-insiders', 'codium', or 'code-oss' |
51 | --mimalloc Use mimalloc for server | 51 | --server Install only the language server |
52 | -h, --help Prints help information | 52 | --mimalloc Use mimalloc for server |
53 | -h, --help Prints help information | ||
53 | " | 54 | " |
54 | ); | 55 | ); |
55 | return Ok(()); | 56 | return Ok(()); |
56 | } | 57 | } |
57 | let server = args.contains("--server"); | 58 | let server = args.contains("--server"); |
58 | let client_code = args.contains("--client-code"); | 59 | let client_code = args.contains("--client"); |
59 | if server && client_code { | 60 | if server && client_code { |
60 | eprintln!( | 61 | eprintln!( |
61 | "error: The argument `--server` cannot be used with `--client-code`\n\n\ | 62 | "error: The argument `--server` cannot be used with `--client`\n\n\ |
62 | For more information try --help" | 63 | For more information try --help" |
63 | ); | 64 | ); |
64 | return Ok(()); | 65 | return Ok(()); |
@@ -67,10 +68,12 @@ FLAGS: | |||
67 | let malloc = | 68 | let malloc = |
68 | if args.contains("--mimalloc") { Malloc::Mimalloc } else { Malloc::System }; | 69 | if args.contains("--mimalloc") { Malloc::Mimalloc } else { Malloc::System }; |
69 | 70 | ||
71 | let client_opt = args.opt_value_from_str("--client")?; | ||
72 | |||
70 | args.finish()?; | 73 | args.finish()?; |
71 | 74 | ||
72 | InstallCmd { | 75 | InstallCmd { |
73 | client: if server { None } else { Some(ClientOpt::VsCode) }, | 76 | client: if server { None } else { Some(client_opt.unwrap_or_default()) }, |
74 | server: if client_code { None } else { Some(ServerOpt { malloc }) }, | 77 | server: if client_code { None } else { Some(ServerOpt { malloc }) }, |
75 | } | 78 | } |
76 | .run() | 79 | .run() |