mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
* fix #232043 * fix compilation error * fix compilation * fix compilation * fix compilation * fix compilation * fix compilation
This commit is contained in:
committed by
GitHub
parent
9a129c0139
commit
e9d6c6afc0
@@ -7,7 +7,7 @@ use std::collections::HashMap;
|
||||
|
||||
use cli::commands::args::{
|
||||
CliCore, Commands, DesktopCodeOptions, ExtensionArgs, ExtensionSubcommand,
|
||||
InstallExtensionArgs, ListExtensionArgs, UninstallExtensionArgs,
|
||||
InstallExtensionArgs, ListExtensionArgs, UninstallExtensionArgs, DownloadExtensionArgs,
|
||||
};
|
||||
|
||||
/// Tries to parse the argv using the legacy CLI interface, looking for its
|
||||
@@ -64,6 +64,7 @@ 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
|
||||
@@ -79,6 +80,17 @@ 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 {
|
||||
|
||||
@@ -272,6 +272,8 @@ pub enum ExtensionSubcommand {
|
||||
Uninstall(UninstallExtensionArgs),
|
||||
/// Update the installed extensions.
|
||||
Update,
|
||||
/// Download an extension.
|
||||
Download(DownloadExtensionArgs),
|
||||
}
|
||||
|
||||
impl ExtensionSubcommand {
|
||||
@@ -305,6 +307,16 @@ 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}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -347,6 +359,21 @@ 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)]
|
||||
|
||||
Reference in New Issue
Block a user