chore: pull more strings from the product.json (#166769)

Fixes the bulk of https://github.com/microsoft/vscode-cli/issues/560
This commit is contained in:
Connor Peet 2022-11-18 18:52:52 -08:00 committed by GitHub
parent 384ba2454f
commit 796ee2bf3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 229 additions and 116 deletions

View file

@ -44,7 +44,9 @@ const setLauncherEnvironmentVars = () => {
['VSCODE_CLI_QUALITY', product.quality], ['VSCODE_CLI_QUALITY', product.quality],
['VSCODE_CLI_NAME_SHORT', product.nameShort], ['VSCODE_CLI_NAME_SHORT', product.nameShort],
['VSCODE_CLI_NAME_LONG', product.nameLong], ['VSCODE_CLI_NAME_LONG', product.nameLong],
['VSCODE_CLI_QUALITYLESS_PRODUCT_NAME', product.nameLong.replace(/ - [a-z]+$/i, '')],
['VSCODE_CLI_APPLICATION_NAME', product.applicationName], ['VSCODE_CLI_APPLICATION_NAME', product.applicationName],
['VSCODE_CLI_EDITOR_WEB_URL', product.editorWebUrl],
['VSCODE_CLI_COMMIT', commit], ['VSCODE_CLI_COMMIT', commit],
[ [
'VSCODE_CLI_WIN32_APP_IDS', 'VSCODE_CLI_WIN32_APP_IDS',
@ -52,6 +54,18 @@ const setLauncherEnvironmentVars = () => {
.filter(([key]) => /^win32.*AppId$/.test(key)) .filter(([key]) => /^win32.*AppId$/.test(key))
.map(([, value]) => String(value).replace(/[{}]/g, '')))), .map(([, value]) => String(value).replace(/[{}]/g, '')))),
], ],
[
'VSCODE_CLI_NAME_LONG_MAP',
!isOSS && JSON.stringify(makeQualityMap(json => json.nameLong)),
],
[
'VSCODE_CLI_APPLICATION_NAME_MAP',
!isOSS && JSON.stringify(makeQualityMap(json => json.applicationName)),
],
[
'VSCODE_CLI_SERVER_NAME_MAP',
!isOSS && JSON.stringify(makeQualityMap(json => json.serverApplicationName)),
],
[ [
'VSCODE_CLI_QUALITY_DOWNLOAD_URIS', 'VSCODE_CLI_QUALITY_DOWNLOAD_URIS',
!isOSS && JSON.stringify(makeQualityMap(json => json.downloadUrl)), !isOSS && JSON.stringify(makeQualityMap(json => json.downloadUrl)),
@ -67,4 +81,4 @@ const setLauncherEnvironmentVars = () => {
if (require.main === module) { if (require.main === module) {
setLauncherEnvironmentVars(); setLauncherEnvironmentVars();
} }
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJlcGFyZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInByZXBhcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Z0dBR2dHOztBQUVoRyxxREFBa0Q7QUFDbEQseUJBQXlCO0FBQ3pCLDZCQUE2QjtBQUM3QixxREFBcUQ7QUFFckQsTUFBTSxJQUFJLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQ2pFLE1BQU0sUUFBUSxHQUFHLENBQUMsSUFBWSxFQUFFLEVBQUUsQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQyxDQUFDLENBQUM7QUFFN0UsSUFBSSxlQUF1QixDQUFDO0FBQzVCLE1BQU0sS0FBSyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsY0FBYyxLQUFLLEtBQUssSUFBSSxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsY0FBYyxDQUFDO0FBQ2xGLElBQUksS0FBSyxFQUFFO0lBQ1YsZUFBZSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLGNBQWMsQ0FBQyxDQUFDO0NBQ2xEO0tBQU07SUFDTixlQUFlLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUUsU0FBUyxFQUFFLE9BQU8sQ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QUMsQ0FBQyxDQUFDO0lBRTdGLEtBQUssTUFBTSxDQUFDLEdBQUcsRUFBRSxLQUFLLENBQUMsSUFBSSxJQUFJLEVBQUU7UUFDaEMsSUFBSSxLQUFLLEVBQUU7WUFDVixPQUFPLENBQUMsR0FBRyxDQUFDLG1DQUFtQyxHQUFHLElBQUksS0FBSyxFQUFFLENBQUMsQ0FBQztTQUMvRDtLQUNEO0FBQ0YsQ0FBQyxDQUFDO0FBRUYsSUFBSSxPQUFPLENBQUMsSUFBSSxLQUFLLE1BQU0sRUFBRTtJQUM1QiwwQkFBMEIsRUFBRSxDQUFDO0NBQzdCIn0=

View file

@ -48,7 +48,9 @@ const setLauncherEnvironmentVars = () => {
['VSCODE_CLI_QUALITY', product.quality], ['VSCODE_CLI_QUALITY', product.quality],
['VSCODE_CLI_NAME_SHORT', product.nameShort], ['VSCODE_CLI_NAME_SHORT', product.nameShort],
['VSCODE_CLI_NAME_LONG', product.nameLong], ['VSCODE_CLI_NAME_LONG', product.nameLong],
['VSCODE_CLI_QUALITYLESS_PRODUCT_NAME', product.nameLong.replace(/ - [a-z]+$/i, '')],
['VSCODE_CLI_APPLICATION_NAME', product.applicationName], ['VSCODE_CLI_APPLICATION_NAME', product.applicationName],
['VSCODE_CLI_EDITOR_WEB_URL', product.editorWebUrl],
['VSCODE_CLI_COMMIT', commit], ['VSCODE_CLI_COMMIT', commit],
[ [
'VSCODE_CLI_WIN32_APP_IDS', 'VSCODE_CLI_WIN32_APP_IDS',
@ -58,13 +60,25 @@ const setLauncherEnvironmentVars = () => {
.map(([, value]) => String(value).replace(/[{}]/g, ''))), .map(([, value]) => String(value).replace(/[{}]/g, ''))),
), ),
], ],
[
'VSCODE_CLI_NAME_LONG_MAP',
!isOSS && JSON.stringify(makeQualityMap(json => json.nameLong)),
],
[
'VSCODE_CLI_APPLICATION_NAME_MAP',
!isOSS && JSON.stringify(makeQualityMap(json => json.applicationName)),
],
[
'VSCODE_CLI_SERVER_NAME_MAP',
!isOSS && JSON.stringify(makeQualityMap(json => json.serverApplicationName)),
],
[ [
'VSCODE_CLI_QUALITY_DOWNLOAD_URIS', 'VSCODE_CLI_QUALITY_DOWNLOAD_URIS',
!isOSS && JSON.stringify(makeQualityMap(json => json.downloadUrl)), !isOSS && JSON.stringify(makeQualityMap(json => json.downloadUrl)),
], ],
]); ]);
console.log(JSON.stringify([...vars].reduce((obj, kv) => ({...obj, [kv[0]]: kv[1]}), {}))); console.log(JSON.stringify([...vars].reduce((obj, kv) => ({ ...obj, [kv[0]]: kv[1] }), {})));
for (const [key, value] of vars) { for (const [key, value] of vars) {
if (value) { if (value) {

21
cli/Cargo.lock generated
View file

@ -232,6 +232,7 @@ dependencies = [
"chrono", "chrono",
"clap", "clap",
"clap_lex", "clap_lex",
"const_format",
"dialoguer", "dialoguer",
"dirs 4.0.0", "dirs 4.0.0",
"flate2", "flate2",
@ -300,6 +301,26 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "const_format"
version = "0.2.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7309d9b4d3d2c0641e018d449232f2e28f1b22933c137f157d3dbc14228b8c0e"
dependencies = [
"const_format_proc_macros",
]
[[package]]
name = "const_format_proc_macros"
version = "0.2.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d897f47bf7270cf70d370f8f98c1abb6d2d4cf60a6845d30e05bfb90c6568650"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]] [[package]]
name = "core-foundation" name = "core-foundation"
version = "0.9.3" version = "0.9.3"

View file

@ -46,6 +46,7 @@ clap_lex = "0.2"
url = "2.3" url = "2.3"
async-trait = "0.1" async-trait = "0.1"
log = "0.4" log = "0.4"
const_format = "0.2"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
windows-service = "0.5" windows-service = "0.5"

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
use crate::{ use crate::{
constants::get_default_user_agent, constants::{get_default_user_agent, PRODUCT_NAME_LONG},
info, log, info, log,
state::{LauncherPaths, PersistedState}, state::{LauncherPaths, PersistedState},
trace, trace,
@ -500,7 +500,7 @@ impl Auth {
} }
let provider = prompt_options( let provider = prompt_options(
"How would you like to log in to VS Code?", format!("How would you like to log in to {}?", PRODUCT_NAME_LONG),
&[AuthProvider::Microsoft, AuthProvider::Github], &[AuthProvider::Microsoft, AuthProvider::Github],
)?; )?;

View file

@ -157,12 +157,7 @@ async fn start_code(context: CommandContext, args: Vec<String>) -> Result<i32, A
.args(args) .args(args)
.status() .status()
.map(|s| s.code().unwrap_or(1)) .map(|s| s.code().unwrap_or(1))
.map_err(|e| { .map_err(|e| wrap(e, format!("error running editor from {}", binary.display())))?;
wrap(
e,
format!("error running VS Code from {}", binary.display()),
)
})?;
Ok(code) Ok(code)
} }

View file

@ -7,21 +7,29 @@ use std::{fmt, path::PathBuf};
use crate::{constants, log, options, tunnels::code_server::CodeServerArgs}; use crate::{constants, log, options, tunnels::code_server::CodeServerArgs};
use clap::{ArgEnum, Args, Parser, Subcommand}; use clap::{ArgEnum, Args, Parser, Subcommand};
use const_format::concatcp;
const TEMPLATE: &str = " const CLI_NAME: &str = concatcp!(constants::PRODUCT_NAME_LONG, " CLI");
Visual Studio Code CLI - {version} const TEMPLATE: &str = concatcp!(
CLI_NAME,
" - {version}
Usage: code-insiders.exe [options][paths...] Usage: ",
constants::APPLICATION_NAME,
" [options][paths...]
To read output from another program, append '-' (e.g. 'echo Hello World | code-insiders.exe -') To read output from another program, append '-' (e.g. 'echo Hello World | ",
constants::APPLICATION_NAME,
" -')
{all-args}"; {all-args}"
);
#[derive(Parser, Debug, Default)] #[derive(Parser, Debug, Default)]
#[clap( #[clap(
help_template = TEMPLATE, help_template = TEMPLATE,
long_about = None, long_about = None,
name = "Visual Studio Code CLI", name = CLI_NAME,
version = match constants::VSCODE_CLI_VERSION { Some(v) => v, None => "dev" }, version = match constants::VSCODE_CLI_VERSION { Some(v) => v, None => "dev" },
)] )]
pub struct IntegratedCli { pub struct IntegratedCli {
@ -53,7 +61,7 @@ pub struct CliCore {
#[clap( #[clap(
help_template = TEMPLATE, help_template = TEMPLATE,
long_about = None, long_about = None,
name = "Visual Studio Code CLI", name = CLI_NAME,
version = match constants::VSCODE_CLI_VERSION { Some(v) => v, None => "dev" }, version = match constants::VSCODE_CLI_VERSION { Some(v) => v, None => "dev" },
)] )]
pub struct StandaloneCli { pub struct StandaloneCli {
@ -115,7 +123,7 @@ impl<'a> From<&'a CliCore> for CodeServerArgs {
#[derive(Subcommand, Debug, Clone)] #[derive(Subcommand, Debug, Clone)]
pub enum StandaloneCommands { pub enum StandaloneCommands {
/// Updates the VS Code CLI. /// Updates the CLI.
Update(StandaloneUpdateArgs), Update(StandaloneUpdateArgs),
} }
@ -133,14 +141,14 @@ pub enum Commands {
/// Run `code tunnel --help` for more usage info. /// Run `code tunnel --help` for more usage info.
Tunnel(TunnelArgs), Tunnel(TunnelArgs),
/// Manage VS Code extensions. /// Manage editor extensions.
#[clap(name = "ext")] #[clap(name = "ext")]
Extension(ExtensionArgs), Extension(ExtensionArgs),
/// Print process usage and diagnostics information. /// Print process usage and diagnostics information.
Status, Status,
/// Changes the version of VS Code you're using. /// Changes the version of the editor you're using.
Version(VersionArgs), Version(VersionArgs),
} }
@ -251,16 +259,16 @@ pub struct VersionArgs {
#[derive(Subcommand, Debug, Clone)] #[derive(Subcommand, Debug, Clone)]
pub enum VersionSubcommand { pub enum VersionSubcommand {
/// Switches the instance of VS Code in use. /// Switches the version of the editor in use.
Use(UseVersionArgs), Use(UseVersionArgs),
/// Shows the currently configured VS Code version. /// Shows the currently configured editor version.
Show, Show,
} }
#[derive(Args, Debug, Clone)] #[derive(Args, Debug, Clone)]
pub struct UseVersionArgs { pub struct UseVersionArgs {
/// The version of VS Code you want to use. Can be "stable", "insiders", /// The version of the editor you want to use. Can be "stable", "insiders",
/// a version number, or an absolute path to an existing install. /// a version number, or an absolute path to an existing install.
#[clap(value_name = "stable | insiders | x.y.z | path")] #[clap(value_name = "stable | insiders | x.y.z | path")]
pub name: String, pub name: String,
@ -346,7 +354,7 @@ impl EditorOptions {
} }
} }
/// Arguments applicable whenever VS Code desktop is launched /// Arguments applicable whenever the desktop editor is launched
#[derive(Args, Debug, Default, Clone)] #[derive(Args, Debug, Default, Clone)]
pub struct DesktopCodeOptions { pub struct DesktopCodeOptions {
/// Set the root path for extensions. /// Set the root path for extensions.
@ -354,11 +362,11 @@ pub struct DesktopCodeOptions {
pub extensions_dir: Option<String>, pub extensions_dir: Option<String>,
/// Specifies the directory that user data is kept in. Can be used to /// Specifies the directory that user data is kept in. Can be used to
/// open multiple distinct instances of Code. /// open multiple distinct instances of the editor.
#[clap(long, value_name = "dir")] #[clap(long, value_name = "dir")]
pub user_data_dir: Option<String>, pub user_data_dir: Option<String>,
/// Sets the VS Code version to use for this command. The preferred version /// Sets the editor version to use for this command. The preferred version
/// can be persisted with `code version use <version>`. Can be "stable", /// can be persisted with `code version use <version>`. Can be "stable",
/// "insiders", a version number, or an absolute path to an existing install. /// "insiders", a version number, or an absolute path to an existing install.
#[clap(long, value_name = "stable | insiders | x.y.z | path")] #[clap(long, value_name = "stable | insiders | x.y.z | path")]
@ -386,7 +394,7 @@ impl DesktopCodeOptions {
#[derive(Args, Debug, Default, Clone)] #[derive(Args, Debug, Default, Clone)]
pub struct GlobalOptions { pub struct GlobalOptions {
/// Directory where CLI metadata, such as VS Code installations, should be stored. /// Directory where CLI metadata should be stored.
#[clap(long, env = "VSCODE_CLI_DATA_DIR", global = true)] #[clap(long, env = "VSCODE_CLI_DATA_DIR", global = true)]
pub cli_data_dir: Option<String>, pub cli_data_dir: Option<String>,
@ -464,7 +472,7 @@ pub struct EditorTroubleshooting {
#[clap(long, value_name = "memory")] #[clap(long, value_name = "memory")]
pub max_memory: Option<usize>, pub max_memory: Option<usize>,
/// Shows all telemetry events which VS code collects. /// Shows all telemetry events which the editor collects.
#[clap(long)] #[clap(long)]
pub telemetry: bool, pub telemetry: bool,
} }

View file

@ -6,6 +6,7 @@
use indicatif::ProgressBar; use indicatif::ProgressBar;
use crate::{ use crate::{
constants::PRODUCT_NAME_LONG,
self_update::SelfUpdate, self_update::SelfUpdate,
update_service::UpdateService, update_service::UpdateService,
util::{errors::AnyError, http::ReqwestSimpleHttp, input::ProgressBarReporter}, util::{errors::AnyError, http::ReqwestSimpleHttp, input::ProgressBarReporter},
@ -23,8 +24,8 @@ pub async fn update(ctx: CommandContext, args: StandaloneUpdateArgs) -> Result<i
let current_version = update_service.get_current_release().await?; let current_version = update_service.get_current_release().await?;
if update_service.is_up_to_date_with(&current_version) { if update_service.is_up_to_date_with(&current_version) {
ctx.log.result(format!( ctx.log.result(format!(
"VS Code is already to to date ({})", "{} is already to to date ({})",
current_version.commit PRODUCT_NAME_LONG, current_version.commit
)); ));
return Ok(1); return Ok(1);
} }

View file

@ -58,9 +58,5 @@ pub async fn show(ctx: CommandContext) -> Result<i32, AnyError> {
} }
fn print_now_using(log: &log::Logger, version: &RequestedVersion, path: &Path) { fn print_now_using(log: &log::Logger, version: &RequestedVersion, path: &Path) {
log.result(&format!( log.result(&format!("Now using {} from {}", version, path.display()));
"Now using VS Code {} from {}",
version,
path.display()
));
} }

View file

@ -5,6 +5,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use const_format::concatcp;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use crate::options::Quality; use crate::options::Quality;
@ -28,13 +29,30 @@ pub const VSCODE_CLI_UPDATE_ENDPOINT: Option<&'static str> =
pub const TUNNEL_SERVICE_USER_AGENT_ENV_VAR: &str = "TUNNEL_SERVICE_USER_AGENT"; pub const TUNNEL_SERVICE_USER_AGENT_ENV_VAR: &str = "TUNNEL_SERVICE_USER_AGENT";
const MAYBE_APPLICATION_NAME: Option<&'static str> = option_env!("VSCODE_CLI_APPLICATION_NAME"); /// Application name as it appears on the CLI.
const MAYBE_PRODUCT_NAME_LONG: Option<&'static str> = option_env!("VSCODE_CLI_NAME_LONG"); pub const APPLICATION_NAME: &str = match option_env!("VSCODE_CLI_APPLICATION_NAME") {
// JSON map of quality names to arrays of app IDs used for them, for example, `{"stable":["ABC123"]}` Some(n) => n,
const MAYBE_CLI_WIN32_APP_IDS: Option<&'static str> = option_env!("VSCODE_CLI_WIN32_APP_IDS"); None => "code",
// JSON map of quality names to download URIs };
const MAYBE_CLI_QUALITY_DOWNLOAD_URIS: Option<&'static str> =
option_env!("VSCODE_CLI_QUALITY_DOWNLOAD_URIS"); /// Full name of the product with its version.
pub const PRODUCT_NAME_LONG: &str = match option_env!("VSCODE_CLI_NAME_LONG") {
Some(n) => n,
None => "Code - OSS",
};
/// Name of the application without quality information.
pub const QUALITYLESS_PRODUCT_NAME: &str =
match option_env!("VSCODE_CLI_QUALITYLESS_PRODUCT_NAME") {
Some(n) => n,
None => "Code",
};
/// Name of the application without quality information.
pub const QUALITYLESS_SERVER_NAME: &str = concatcp!(QUALITYLESS_PRODUCT_NAME, " Server");
/// Web URL the editor is hosted at. For VS Code, this is vscode.dev.
pub const EDITOR_WEB_URL: Option<&'static str> = option_env!("VSCODE_CLI_EDITOR_WEB_URL");
pub fn get_default_user_agent() -> String { pub fn get_default_user_agent() -> String {
format!( format!(
@ -49,11 +67,24 @@ lazy_static! {
Ok(ua) if !ua.is_empty() => format!("{} {}", ua, get_default_user_agent()), Ok(ua) if !ua.is_empty() => format!("{} {}", ua, get_default_user_agent()),
_ => get_default_user_agent(), _ => get_default_user_agent(),
}; };
/// Map of quality names to arrays of app IDs used for them, for example, `{"stable":["ABC123"]}`
pub static ref WIN32_APP_IDS: Option<HashMap<Quality, Vec<String>>> = pub static ref WIN32_APP_IDS: Option<HashMap<Quality, Vec<String>>> =
MAYBE_CLI_WIN32_APP_IDS.and_then(|s| serde_json::from_str(s).unwrap()); option_env!("VSCODE_CLI_WIN32_APP_IDS").and_then(|s| serde_json::from_str(s).unwrap());
/// Map of quality names to desktop download URIs
pub static ref QUALITY_DOWNLOAD_URIS: Option<HashMap<Quality, String>> = pub static ref QUALITY_DOWNLOAD_URIS: Option<HashMap<Quality, String>> =
MAYBE_CLI_QUALITY_DOWNLOAD_URIS.and_then(|s| serde_json::from_str(s).unwrap()); option_env!("VSCODE_CLI_QUALITY_DOWNLOAD_URIS").and_then(|s| serde_json::from_str(s).unwrap());
pub static ref PRODUCT_NAME_LONG: &'static str =
MAYBE_PRODUCT_NAME_LONG.unwrap_or("Code - OSS"); /// Map of qualities to the long name of the app in that quality
pub static ref APPLICATION_NAME: &'static str = MAYBE_APPLICATION_NAME.unwrap_or("code"); pub static ref PRODUCT_NAME_LONG_MAP: Option<HashMap<Quality, String>> =
option_env!("VSCODE_CLI_NAME_LONG_MAP").and_then(|s| serde_json::from_str(s).unwrap());
/// Map of qualities to the application name
pub static ref APPLICATION_NAME_MAP: Option<HashMap<Quality, String>> =
option_env!("VSCODE_CLI_APPLICATION_NAME_MAP").and_then(|s| serde_json::from_str(s).unwrap());
/// Map of qualities to the server name
pub static ref SERVER_NAME_MAP: Option<HashMap<Quality, String>> =
option_env!("VSCODE_CLI_SERVER_NAME_MAP").and_then(|s| serde_json::from_str(s).unwrap());
} }

View file

@ -14,7 +14,7 @@ use regex::Regex;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{ use crate::{
constants::QUALITY_DOWNLOAD_URIS, constants::{QUALITYLESS_PRODUCT_NAME, QUALITY_DOWNLOAD_URIS},
log, log,
options::{self, Quality}, options::{self, Quality},
state::{LauncherPaths, PersistedState}, state::{LauncherPaths, PersistedState},
@ -249,7 +249,10 @@ impl CodeVersionManager {
/// Shows a nice UI prompt to users asking them if they want to install the /// Shows a nice UI prompt to users asking them if they want to install the
/// requested version. /// requested version.
pub fn prompt_to_install(version: &RequestedVersion) { pub fn prompt_to_install(version: &RequestedVersion) {
println!("No installation of VS Code {} was found.", version); println!(
"No installation of {} {} was found.",
QUALITYLESS_PRODUCT_NAME, version
);
if let RequestedVersion::Quality(quality) = version { if let RequestedVersion::Quality(quality) = version {
if let Some(uri) = QUALITY_DOWNLOAD_URIS.as_ref().and_then(|m| m.get(quality)) { if let Some(uri) = QUALITY_DOWNLOAD_URIS.as_ref().and_then(|m| m.get(quality)) {
@ -265,14 +268,14 @@ pub fn prompt_to_install(version: &RequestedVersion) {
} }
println!(); println!();
println!("If you already installed VS Code and we didn't detect it, run `{} --install-dir /path/to/installation`", version.get_command()); println!("If you already installed {} and we didn't detect it, run `{} --install-dir /path/to/installation`", QUALITYLESS_PRODUCT_NAME, version.get_command());
} }
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
fn detect_installed_program(log: &log::Logger, quality: Quality) -> io::Result<Vec<PathBuf>> { fn detect_installed_program(log: &log::Logger, quality: Quality) -> io::Result<Vec<PathBuf>> {
// easy, fast detection for where apps are usually installed // easy, fast detection for where apps are usually installed
let mut probable = PathBuf::from("/Applications"); let mut probable = PathBuf::from("/Applications");
let app_name = quality.get_macos_app_name(); let app_name = quality.get_long_name();
probable.push(format!("{}.app", app_name)); probable.push(format!("{}.app", app_name));
if probable.exists() { if probable.exists() {
probable.extend(["Contents/Resources", "app", "bin", "code"]); probable.extend(["Contents/Resources", "app", "bin", "code"]);
@ -378,11 +381,7 @@ fn detect_installed_program(_log: &log::Logger, quality: Quality) -> io::Result<
[ [
location.as_str(), location.as_str(),
"bin", "bin",
match quality { &format!("{}.cmd", quality.get_application_name()),
Quality::Exploration => "code-exploration.cmd",
Quality::Insiders => "code-insiders.cmd",
Quality::Stable => "code.cmd",
},
] ]
.iter() .iter()
.collect(), .collect(),
@ -407,7 +406,7 @@ fn detect_installed_program(log: &log::Logger, quality: Quality) -> io::Result<V
} }
}; };
let name = quality.get_commandline_name(); let name = quality.get_application_name();
let current_exe = std::env::current_exe().expect("expected to read current exe"); let current_exe = std::env::current_exe().expect("expected to read current exe");
let mut output = vec![]; let mut output = vec![];
for dir in path.split(':') { for dir in path.split(':') {

View file

@ -12,8 +12,8 @@ pub mod log;
pub mod commands; pub mod commands;
pub mod desktop; pub mod desktop;
pub mod options; pub mod options;
pub mod self_update;
pub mod state; pub mod state;
pub mod tunnels; pub mod tunnels;
pub mod self_update;
pub mod update_service; pub mod update_service;
pub mod util; pub mod util;

View file

@ -7,6 +7,8 @@ use std::fmt;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::constants::{APPLICATION_NAME_MAP, PRODUCT_NAME_LONG_MAP, SERVER_NAME_MAP};
#[derive(clap::ArgEnum, Copy, Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)] #[derive(clap::ArgEnum, Copy, Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
pub enum Quality { pub enum Quality {
#[serde(rename = "stable")] #[serde(rename = "stable")]
@ -18,7 +20,7 @@ pub enum Quality {
} }
impl Quality { impl Quality {
/// Lowercased name in paths and protocol /// Lowercased quality name in paths and protocol
pub fn get_machine_name(&self) -> &'static str { pub fn get_machine_name(&self) -> &'static str {
match self { match self {
Quality::Insiders => "insiders", Quality::Insiders => "insiders",
@ -27,7 +29,7 @@ impl Quality {
} }
} }
/// Uppercased display name for humans /// Uppercased quality display name for humans
pub fn get_capitalized_name(&self) -> &'static str { pub fn get_capitalized_name(&self) -> &'static str {
match self { match self {
Quality::Insiders => "Insiders", Quality::Insiders => "Insiders",
@ -36,37 +38,38 @@ impl Quality {
} }
} }
pub fn get_macos_app_name(&self) -> &'static str { /// Product long name
match self { pub fn get_long_name(&self) -> &'static str {
Quality::Insiders => "Visual Studio Code - Insiders", PRODUCT_NAME_LONG_MAP
Quality::Exploration => "Visual Studio Code - Exploration", .as_ref()
Quality::Stable => "Visual Studio Code", .and_then(|m| m.get(self))
} .map(|s| s.as_str())
.unwrap_or("Code - OSS")
} }
pub fn get_commandline_name(&self) -> &'static str { /// Product application name
match self { pub fn get_application_name(&self) -> &'static str {
Quality::Insiders => "code-insiders", APPLICATION_NAME_MAP
Quality::Exploration => "code-exploration", .as_ref()
Quality::Stable => "code", .and_then(|m| m.get(self))
} .map(|s| s.as_str())
.unwrap_or("code")
} }
#[cfg(target_os = "windows")] /// Server application name
pub fn server_entrypoint(&self) -> &'static str { pub fn server_entrypoint(&self) -> String {
match self { let mut server_name = SERVER_NAME_MAP
Quality::Insiders => "code-server-insiders.cmd", .as_ref()
Quality::Exploration => "code-server-exploration.cmd", .and_then(|m| m.get(self))
Quality::Stable => "code-server.cmd", .map(|s| s.as_str())
} .unwrap_or("code-server-oss")
} .to_string();
#[cfg(not(target_os = "windows"))]
pub fn server_entrypoint(&self) -> &'static str { if cfg!(windows) {
match self { server_name.push_str(".cmd");
Quality::Insiders => "code-server-insiders",
Quality::Exploration => "code-server-exploration",
Quality::Stable => "code-server",
} }
server_name
} }
} }

View file

@ -8,7 +8,6 @@ pub mod dev_tunnels;
pub mod legal; pub mod legal;
pub mod paths; pub mod paths;
mod socket_signal;
mod control_server; mod control_server;
mod name_generator; mod name_generator;
mod port_forwarder; mod port_forwarder;
@ -19,10 +18,11 @@ mod server_bridge;
mod service; mod service;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
mod service_linux; mod service_linux;
#[cfg(target_os = "windows")]
mod service_windows;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
mod service_macos; mod service_macos;
#[cfg(target_os = "windows")]
mod service_windows;
mod socket_signal;
pub use control_server::serve; pub use control_server::serve;
pub use service::{ pub use service::{

View file

@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
use super::paths::{InstalledServer, LastUsedServers, ServerPaths}; use super::paths::{InstalledServer, LastUsedServers, ServerPaths};
use crate::constants::{APPLICATION_NAME, QUALITYLESS_PRODUCT_NAME, QUALITYLESS_SERVER_NAME};
use crate::options::{Quality, TelemetryLevel}; use crate::options::{Quality, TelemetryLevel};
use crate::state::LauncherPaths; use crate::state::LauncherPaths;
use crate::update_service::{ use crate::update_service::{
@ -334,7 +335,8 @@ async fn download_server(
info!( info!(
log, log,
"Downloading VS Code server -> {}", "Downloading {} server -> {}",
QUALITYLESS_PRODUCT_NAME,
save_path.display() save_path.display()
); );
@ -445,7 +447,7 @@ impl<'a, Http: SimpleHttp + Send + Sync + Clone + 'static> ServerBuilder<'a, Htt
}; };
info!(self.logger, "Found running server (pid={})", pid); info!(self.logger, "Found running server (pid={})", pid);
if !Path::new(&self.server_paths.logfile).exists() { if !Path::new(&self.server_paths.logfile).exists() {
warning!(self.logger, "VS Code Server is running but its logfile is missing. Don't delete the VS Code Server manually, run the command 'code-server prune'."); warning!(self.logger, "{} Server is running but its logfile is missing. Don't delete the {} Server manually, run the command '{} prune'.", QUALITYLESS_PRODUCT_NAME, QUALITYLESS_PRODUCT_NAME, APPLICATION_NAME);
return Ok(None); return Ok(None);
} }
@ -479,7 +481,10 @@ impl<'a, Http: SimpleHttp + Send + Sync + Clone + 'static> ServerBuilder<'a, Htt
/// Ensures the server is set up in the configured directory. /// Ensures the server is set up in the configured directory.
pub async fn setup(&self) -> Result<(), AnyError> { pub async fn setup(&self) -> Result<(), AnyError> {
debug!(self.logger, "Installing and setting up VS Code Server..."); debug!(
self.logger,
"Installing and setting up {}...", QUALITYLESS_SERVER_NAME
);
check_and_create_dir(&self.server_paths.server_dir).await?; check_and_create_dir(&self.server_paths.server_dir).await?;
install_server_if_needed( install_server_if_needed(
self.logger, self.logger,

View file

@ -3,7 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
use crate::commands::tunnels::ShutdownSignal; use crate::commands::tunnels::ShutdownSignal;
use crate::constants::{CONTROL_PORT, PROTOCOL_VERSION, VSCODE_CLI_VERSION}; use crate::constants::{
CONTROL_PORT, EDITOR_WEB_URL, PROTOCOL_VERSION, QUALITYLESS_SERVER_NAME, VSCODE_CLI_VERSION,
};
use crate::log; use crate::log;
use crate::self_update::SelfUpdate; use crate::self_update::SelfUpdate;
use crate::state::LauncherPaths; use crate::state::LauncherPaths;
@ -131,7 +133,10 @@ pub struct ServerTermination {
} }
fn print_listening(log: &log::Logger, tunnel_name: &str) { fn print_listening(log: &log::Logger, tunnel_name: &str) {
debug!(log, "VS Code Server is listening for incoming connections"); debug!(
log,
"{} is listening for incoming connections", QUALITYLESS_SERVER_NAME
);
let home_dir = dirs::home_dir().unwrap_or_else(|| PathBuf::from("")); let home_dir = dirs::home_dir().unwrap_or_else(|| PathBuf::from(""));
let current_dir = env::current_dir().unwrap_or_else(|_| PathBuf::from("")); let current_dir = env::current_dir().unwrap_or_else(|_| PathBuf::from(""));
@ -142,7 +147,12 @@ fn print_listening(log: &log::Logger, tunnel_name: &str) {
current_dir current_dir
}; };
let mut addr = url::Url::parse("https://insiders.vscode.dev").unwrap(); let base_web_url = match EDITOR_WEB_URL {
Some(u) => u,
None => return,
};
let mut addr = url::Url::parse(base_web_url).unwrap();
{ {
let mut ps = addr.path_segments_mut().unwrap(); let mut ps = addr.path_segments_mut().unwrap();
ps.push("tunnel"); ps.push("tunnel");

View file

@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
use crate::constants::PRODUCT_NAME_LONG;
use crate::state::{LauncherPaths, PersistedState}; use crate::state::{LauncherPaths, PersistedState};
use crate::util::errors::{AnyError, MissingLegalConsent}; use crate::util::errors::{AnyError, MissingLegalConsent};
use crate::util::input::prompt_yn; use crate::util::input::prompt_yn;
@ -46,10 +47,10 @@ pub fn require_consent(
load.consented = Some(true); load.consented = Some(true);
} }
Ok(false) => { Ok(false) => {
return Err(AnyError::from(MissingLegalConsent( return Err(AnyError::from(MissingLegalConsent(format!(
"Sorry you cannot use VS Code Server CLI without accepting the terms." "Sorry you cannot use {} CLI without accepting the terms.",
.to_string(), PRODUCT_NAME_LONG
))) ))))
} }
Err(e) => return Err(AnyError::from(MissingLegalConsent(e.to_string()))), Err(e) => return Err(AnyError::from(MissingLegalConsent(e.to_string()))),
} }

View file

@ -64,7 +64,7 @@ impl SystemdService {
} }
fn service_name_string() -> String { fn service_name_string() -> String {
format!("{}-tunnel.service", &*APPLICATION_NAME) format!("{}-tunnel.service", APPLICATION_NAME)
} }
} }
@ -186,7 +186,7 @@ fn write_systemd_service_file(
[Install]\n\ [Install]\n\
WantedBy=multi-user.target\n\ WantedBy=multi-user.target\n\
", ",
&*PRODUCT_NAME_LONG, PRODUCT_NAME_LONG,
exe.into_os_string().to_string_lossy(), exe.into_os_string().to_string_lossy(),
args.join("\" \"") args.join("\" \"")
)?; )?;

View file

@ -23,7 +23,7 @@ use crate::{
}, },
}; };
use super::{ServiceManager, service::tail_log_file}; use super::{service::tail_log_file, ServiceManager};
pub struct LaunchdService { pub struct LaunchdService {
log: log::Logger, log: log::Logger,
@ -115,7 +115,7 @@ impl ServiceManager for LaunchdService {
} }
fn get_service_label() -> String { fn get_service_label() -> String {
format!("com.visualstudio.{}.tunnel", &*APPLICATION_NAME) format!("com.visualstudio.{}.tunnel", APPLICATION_NAME)
} }
fn get_service_file_path() -> Result<PathBuf, MissingHomeDirectory> { fn get_service_file_path() -> Result<PathBuf, MissingHomeDirectory> {

View file

@ -21,6 +21,7 @@ use windows_service::{
use crate::{ use crate::{
commands::tunnels::ShutdownSignal, commands::tunnels::ShutdownSignal,
constants::QUALITYLESS_PRODUCT_NAME,
util::errors::{wrap, wrapdbg, AnyError, WindowsNeedsElevation}, util::errors::{wrap, wrapdbg, AnyError, WindowsNeedsElevation},
}; };
use crate::{ use crate::{
@ -64,7 +65,7 @@ impl CliServiceManager for WindowsService {
let mut service_info = ServiceInfo { let mut service_info = ServiceInfo {
name: OsString::from(SERVICE_NAME), name: OsString::from(SERVICE_NAME),
display_name: OsString::from("VS Code Tunnel"), display_name: OsString::from(format!("{} Tunnel", QUALITYLESS_PRODUCT_NAME)),
service_type: SERVICE_TYPE, service_type: SERVICE_TYPE,
start_type: ServiceStartType::AutoStart, start_type: ServiceStartType::AutoStart,
error_control: ServiceErrorControl::Normal, error_control: ServiceErrorControl::Normal,

View file

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
use super::errors::{wrap, AnyError, CommandFailed, WrappedError}; use super::errors::{wrap, AnyError, CommandFailed, WrappedError};
use std::{ffi::OsStr, process::Stdio, borrow::Cow}; use std::{borrow::Cow, ffi::OsStr, process::Stdio};
use tokio::process::Command; use tokio::process::Command;
pub async fn capture_command_and_check_status( pub async fn capture_command_and_check_status(

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
use std::fmt::Display; use std::fmt::Display;
use crate::constants::CONTROL_PORT; use crate::constants::{APPLICATION_NAME, CONTROL_PORT, QUALITYLESS_PRODUCT_NAME};
// Wraps another error with additional info. // Wraps another error with additional info.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -282,8 +282,11 @@ impl std::fmt::Display for NoInstallInUserProvidedPath {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!( write!(
f, f,
"No VS Code installation could be found in {}. You can run `code --use-quality=stable` to switch to the latest stable version of VS Code.", "No {} installation could be found in {}. You can run `{} --use-quality=stable` to switch to the latest stable version of {}.",
self.0 QUALITYLESS_PRODUCT_NAME,
self.0,
APPLICATION_NAME,
QUALITYLESS_PRODUCT_NAME
) )
} }
} }
@ -378,7 +381,11 @@ pub struct CorruptDownload(pub String);
impl std::fmt::Display for CorruptDownload { impl std::fmt::Display for CorruptDownload {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "Error updating the VS Code CLI: {}", self.0) write!(
f,
"Error updating the {} CLI: {}",
QUALITYLESS_PRODUCT_NAME, self.0
)
} }
} }

View file

@ -46,7 +46,7 @@ pub fn prompt_yn(text: &str) -> Result<bool, WrappedError> {
.map_err(|e| wrap(e, "Failed to read confirm input")) .map_err(|e| wrap(e, "Failed to read confirm input"))
} }
pub fn prompt_options<T>(text: &str, options: &[T]) -> Result<T, WrappedError> pub fn prompt_options<T>(text: impl Into<String>, options: &[T]) -> Result<T, WrappedError>
where where
T: Display + Copy, T: Display + Copy,
{ {

View file

@ -5,6 +5,7 @@
use std::cmp::Ordering; use std::cmp::Ordering;
use super::command::capture_command; use super::command::capture_command;
use crate::constants::QUALITYLESS_SERVER_NAME;
use crate::update_service::Platform; use crate::update_service::Platform;
use crate::util::errors::SetupError; use crate::util::errors::SetupError;
use lazy_static::lazy_static; use lazy_static::lazy_static;
@ -41,8 +42,13 @@ impl PreReqChecker {
#[cfg(not(target_os = "linux"))] #[cfg(not(target_os = "linux"))]
pub async fn verify(&self) -> Result<Platform, AnyError> { pub async fn verify(&self) -> Result<Platform, AnyError> {
use crate::constants::QUALITYLESS_PRODUCT_NAME;
Platform::env_default().ok_or_else(|| { Platform::env_default().ok_or_else(|| {
SetupError("VS Code is not supported on this platform".to_owned()).into() SetupError(format!(
"{} is not supported on this platform",
QUALITYLESS_PRODUCT_NAME
))
.into()
}) })
} }
@ -91,8 +97,8 @@ impl PreReqChecker {
.join("\n"); .join("\n");
Err(AnyError::from(SetupError(format!( Err(AnyError::from(SetupError(format!(
"This machine not meet VS Code Server's prerequisites, expected either...\n{}", "This machine not meet {}'s prerequisites, expected either...\n{}",
bullets, QUALITYLESS_SERVER_NAME, bullets,
)))) ))))
} }
} }
@ -107,8 +113,8 @@ async fn check_musl_interpreter() -> Result<(), String> {
if fs::metadata(MUSL_PATH).await.is_err() { if fs::metadata(MUSL_PATH).await.is_err() {
return Err(format!( return Err(format!(
"find {}, which is required to run the VS Code Server in musl environments", "find {}, which is required to run the {} in musl environments",
MUSL_PATH MUSL_PATH, QUALITYLESS_SERVER_NAME
)); ));
} }

View file

@ -1,7 +1,7 @@
{ {
"name": "code-oss-dev", "name": "code-oss-dev",
"version": "1.74.0", "version": "1.74.0",
"distro": "540bfe34933334669527ef1900a9e112965fbdde", "distro": "22b60ce5f0f5a4db5d17091721f4d84891aec3b8",
"author": { "author": {
"name": "Microsoft Corporation" "name": "Microsoft Corporation"
}, },