#232043 revert cli command and support downloading VSIX in UI (#233843)

* Revert "fix #232043 (#233596)"

This reverts commit e9d6c6afc0.

* #232043 revert cli command and support downloading VSIX in UI
This commit is contained in:
Sandeep Somavarapu
2024-11-14 15:41:28 +01:00
committed by GitHub
parent 02d23bdf5d
commit 653fd419de
11 changed files with 58 additions and 99 deletions

View File

@@ -7,7 +7,7 @@ use std::collections::HashMap;
use cli::commands::args::{
CliCore, Commands, DesktopCodeOptions, ExtensionArgs, ExtensionSubcommand,
InstallExtensionArgs, ListExtensionArgs, UninstallExtensionArgs, DownloadExtensionArgs,
InstallExtensionArgs, ListExtensionArgs, UninstallExtensionArgs,
};
/// Tries to parse the argv using the legacy CLI interface, looking for its
@@ -64,7 +64,6 @@ pub fn try_parse_legacy(
// Now translate them to subcommands.
// --list-extensions -> ext list
// --update-extensions -> update
// --download-extension -> ext download <id>
// --install-extension=id -> ext install <id>
// --uninstall-extension=id -> ext uninstall <id>
// --status -> status
@@ -80,17 +79,6 @@ pub fn try_parse_legacy(
})),
..Default::default()
})
} else if let Some(exts) = args.get("download-extension") {
Some(CliCore {
subcommand: Some(Commands::Extension(ExtensionArgs {
subcommand: ExtensionSubcommand::Download(DownloadExtensionArgs {
id: exts.to_vec(),
location: get_first_arg_value("location"),
}),
desktop_code_options,
})),
..Default::default()
})
} else if let Some(exts) = args.remove("install-extension") {
Some(CliCore {
subcommand: Some(Commands::Extension(ExtensionArgs {

View File

@@ -272,8 +272,6 @@ pub enum ExtensionSubcommand {
Uninstall(UninstallExtensionArgs),
/// Update the installed extensions.
Update,
/// Download an extension.
Download(DownloadExtensionArgs),
}
impl ExtensionSubcommand {
@@ -307,16 +305,6 @@ impl ExtensionSubcommand {
ExtensionSubcommand::Update => {
target.push("--update-extensions".to_string());
}
ExtensionSubcommand::Download(args) => {
for id in args.id.iter() {
target.push(format!("--download-extension={id}"));
}
if let Some(location) = &args.location {
if !location.is_empty() {
target.push(format!("--location={location}"));
}
}
}
}
}
}
@@ -359,21 +347,6 @@ pub struct UninstallExtensionArgs {
pub id: Vec<String>,
}
#[derive(Args, Debug, Clone)]
pub struct DownloadExtensionArgs {
/// Id of the extension to download. The identifier of an
/// extension is '${publisher}.${name}'. Should provide '--location' to specify the location to download the VSIX.
/// To download a specific version provide '@${version}'.
/// For example: 'vscode.csharp@1.2.3'.
#[clap(name = "ext-id")]
pub id: Vec<String>,
/// Specify the location to download the VSIX.
#[clap(long, value_name = "location")]
pub location: Option<String>,
}
#[derive(Args, Debug, Clone)]
pub struct VersionArgs {
#[clap(subcommand)]