add cli update-extensions prototype

This commit is contained in:
samhanic
2023-12-03 14:25:40 +01:00
parent dc226d2616
commit 74c419b5bd
14 changed files with 46 additions and 5 deletions

View File

@@ -60,6 +60,7 @@ pub fn try_parse_legacy(
// Now translate them to subcommands.
// --list-extensions -> ext list
// --update-extensions -> update
// --install-extension=id -> ext install <id>
// --uninstall-extension=id -> ext uninstall <id>
// --status -> status
@@ -87,6 +88,14 @@ pub fn try_parse_legacy(
})),
..Default::default()
})
} else if let Some(_exts) = args.remove("update-extensions") {
Some(CliCore {
subcommand: Some(Commands::Extension(ExtensionArgs {
subcommand: ExtensionSubcommand::Update,
desktop_code_options,
})),
..Default::default()
})
} else if let Some(exts) = args.remove("uninstall-extension") {
Some(CliCore {
subcommand: Some(Commands::Extension(ExtensionArgs {

View File

@@ -254,6 +254,8 @@ pub enum ExtensionSubcommand {
Install(InstallExtensionArgs),
/// Uninstall an extension.
Uninstall(UninstallExtensionArgs),
/// Update the marketplace-installed extensions.
Update,
}
impl ExtensionSubcommand {
@@ -284,6 +286,9 @@ impl ExtensionSubcommand {
target.push(format!("--uninstall-extension={}", id));
}
}
ExtensionSubcommand::Update => {
target.push("--update-extensions".to_string());
}
}
}
}

View File

@@ -58,6 +58,7 @@ pub struct CodeServerArgs {
// extension management
pub install_extensions: Vec<String>,
pub uninstall_extensions: Vec<String>,
pub update_extensions: bool,
pub list_extensions: bool,
pub show_versions: bool,
pub category: Option<String>,
@@ -129,6 +130,9 @@ impl CodeServerArgs {
for extension in &self.uninstall_extensions {
args.push(format!("--uninstall-extension={}", extension));
}
if self.update_extensions {
args.push(String::from("--update-extensions"));
}
if self.list_extensions {
args.push(String::from("--list-extensions"));
if self.show_versions {