Add client install support for code-exploration build.

This commit is contained in:
Jérémy 2020-12-08 19:23:25 +01:00
parent e2e6b709e6
commit 7cf2c0d46f

View file

@ -16,6 +16,7 @@ pub struct InstallCmd {
#[derive(Clone, Copy)]
pub enum ClientOpt {
VsCode,
VsCodeExploration,
VsCodeInsiders,
VsCodium,
VsCodeOss,
@ -26,10 +27,11 @@ impl ClientOpt {
pub const fn as_cmds(&self) -> &'static [&'static str] {
match self {
ClientOpt::VsCode => &["code"],
ClientOpt::VsCodeExploration => &["code-exploration"],
ClientOpt::VsCodeInsiders => &["code-insiders"],
ClientOpt::VsCodium => &["codium"],
ClientOpt::VsCodeOss => &["code-oss"],
ClientOpt::Any => &["code", "code-insiders", "codium", "code-oss"],
ClientOpt::Any => &["code", "code-exploration", "code-insiders", "codium", "code-oss"],
}
}
}
@ -44,11 +46,17 @@ impl std::str::FromStr for ClientOpt {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
[ClientOpt::VsCode, ClientOpt::VsCodeInsiders, ClientOpt::VsCodium, ClientOpt::VsCodeOss]
.iter()
.copied()
.find(|c| [s] == c.as_cmds())
.ok_or_else(|| anyhow::format_err!("no such client"))
[
ClientOpt::VsCode,
ClientOpt::VsCodeExploration,
ClientOpt::VsCodeInsiders,
ClientOpt::VsCodium,
ClientOpt::VsCodeOss,
]
.iter()
.copied()
.find(|c| [s] == c.as_cmds())
.ok_or_else(|| anyhow::format_err!("no such client"))
}
}