aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xtask/src/install.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/xtask/src/install.rs b/xtask/src/install.rs
index 78a8af797..12962bcfa 100644
--- a/xtask/src/install.rs
+++ b/xtask/src/install.rs
@@ -16,6 +16,7 @@ pub struct InstallCmd {
16#[derive(Clone, Copy)] 16#[derive(Clone, Copy)]
17pub enum ClientOpt { 17pub enum ClientOpt {
18 VsCode, 18 VsCode,
19 VsCodeExploration,
19 VsCodeInsiders, 20 VsCodeInsiders,
20 VsCodium, 21 VsCodium,
21 VsCodeOss, 22 VsCodeOss,
@@ -26,10 +27,11 @@ impl ClientOpt {
26 pub const fn as_cmds(&self) -> &'static [&'static str] { 27 pub const fn as_cmds(&self) -> &'static [&'static str] {
27 match self { 28 match self {
28 ClientOpt::VsCode => &["code"], 29 ClientOpt::VsCode => &["code"],
30 ClientOpt::VsCodeExploration => &["code-exploration"],
29 ClientOpt::VsCodeInsiders => &["code-insiders"], 31 ClientOpt::VsCodeInsiders => &["code-insiders"],
30 ClientOpt::VsCodium => &["codium"], 32 ClientOpt::VsCodium => &["codium"],
31 ClientOpt::VsCodeOss => &["code-oss"], 33 ClientOpt::VsCodeOss => &["code-oss"],
32 ClientOpt::Any => &["code", "code-insiders", "codium", "code-oss"], 34 ClientOpt::Any => &["code", "code-exploration", "code-insiders", "codium", "code-oss"],
33 } 35 }
34 } 36 }
35} 37}
@@ -44,11 +46,17 @@ impl std::str::FromStr for ClientOpt {
44 type Err = anyhow::Error; 46 type Err = anyhow::Error;
45 47
46 fn from_str(s: &str) -> Result<Self, Self::Err> { 48 fn from_str(s: &str) -> Result<Self, Self::Err> {
47 [ClientOpt::VsCode, ClientOpt::VsCodeInsiders, ClientOpt::VsCodium, ClientOpt::VsCodeOss] 49 [
48 .iter() 50 ClientOpt::VsCode,
49 .copied() 51 ClientOpt::VsCodeExploration,
50 .find(|c| [s] == c.as_cmds()) 52 ClientOpt::VsCodeInsiders,
51 .ok_or_else(|| anyhow::format_err!("no such client")) 53 ClientOpt::VsCodium,
54 ClientOpt::VsCodeOss,
55 ]
56 .iter()
57 .copied()
58 .find(|c| [s] == c.as_cmds())
59 .ok_or_else(|| anyhow::format_err!("no such client"))
52 } 60 }
53} 61}
54 62