remove show_update_window functionality
dependabot is trying to update pulldown-cmark, but it won't work because the API has changed. The update window is not enabled by default and I don't think anyone uses it anyway, so let's just remove it and have less code to compile and maintain. closes: https://github.com/wez/wezterm/pull/4964
This commit is contained in:
8 files changed
+14
-588
No files matched your search
Generated
-22
@@ -2099,15 +2099,6 @@ dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getopts"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5"
|
||||
dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.12"
|
||||
@@ -4279,18 +4270,6 @@ dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pulldown-cmark"
|
||||
version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b"
|
||||
dependencies = [
|
||||
"bitflags 2.4.2",
|
||||
"getopts",
|
||||
"memchr",
|
||||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pure-rust-locales"
|
||||
version = "0.7.0"
|
||||
@@ -6454,7 +6433,6 @@ dependencies = [
|
||||
"parking_lot 0.12.1",
|
||||
"portable-pty",
|
||||
"promise",
|
||||
"pulldown-cmark",
|
||||
"rangeset",
|
||||
"ratelim",
|
||||
"rayon",
|
||||
|
||||
@@ -687,7 +687,10 @@ pub struct Config {
|
||||
|
||||
#[dynamic(default = "default_check_for_updates")]
|
||||
pub check_for_updates: bool,
|
||||
#[dynamic(default)]
|
||||
#[dynamic(
|
||||
default,
|
||||
deprecated = "this option no longer does anything and will be removed in a future release"
|
||||
)]
|
||||
pub show_update_window: bool,
|
||||
|
||||
#[dynamic(default = "default_update_interval")]
|
||||
|
||||
@@ -25,6 +25,9 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
* Wayland: currently being reimplemented, it maybe more unstable than usual.
|
||||
Please file GH issues for any problems you see.
|
||||
Many thanks to @tzx! #4777
|
||||
* [show_update_window](config/lua/config/show_update_window.md) has been
|
||||
deprecated; it no longer has any effect and will be removed in a future
|
||||
release.
|
||||
#### New
|
||||
#### Fixed
|
||||
* Race condition when very quickly adjusting font scale. Thanks to @jknockel!
|
||||
|
||||
@@ -14,3 +14,7 @@ the automatic update checks.
|
||||
```lua
|
||||
config.show_update_window = false
|
||||
```
|
||||
|
||||
{{since('nightly')}}
|
||||
|
||||
This option no longer has any effect and will be removed in a future release.
|
||||
@@ -70,7 +70,6 @@ ordered-float = "4.1"
|
||||
parking_lot = "0.12"
|
||||
portable-pty = { path = "../pty", features = ["serde_support"]}
|
||||
promise = { path = "../promise" }
|
||||
pulldown-cmark = "0.9"
|
||||
rangeset = { path = "../rangeset" }
|
||||
ratelim= { path = "../ratelim" }
|
||||
rayon = "1.7"
|
||||
|
||||
@@ -39,7 +39,6 @@ mod download;
|
||||
mod frontend;
|
||||
mod glyphcache;
|
||||
mod inputmap;
|
||||
mod markdown;
|
||||
mod overlay;
|
||||
mod quad;
|
||||
mod renderstate;
|
||||
|
||||
@@ -1,276 +0,0 @@
|
||||
use pulldown_cmark::{Event, Options, Parser, Tag};
|
||||
use std::io::Read;
|
||||
use std::sync::Arc;
|
||||
use termwiz::cell::*;
|
||||
use termwiz::color::AnsiColor;
|
||||
use termwiz::surface::Change;
|
||||
use termwiz::terminal::ScreenSize;
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
|
||||
pub struct RenderState {
|
||||
screen_size: ScreenSize,
|
||||
changes: Vec<Change>,
|
||||
current_list_item: Option<u64>,
|
||||
current_indent: Option<usize>,
|
||||
x_pos: usize,
|
||||
wrap_width: usize,
|
||||
}
|
||||
|
||||
fn is_whitespace_word(word: &str) -> bool {
|
||||
word.chars().any(|c| c.is_whitespace())
|
||||
}
|
||||
|
||||
impl RenderState {
|
||||
pub fn into_changes(self) -> Vec<Change> {
|
||||
self.changes
|
||||
}
|
||||
|
||||
pub fn new(wrap_width: usize, screen_size: ScreenSize) -> Self {
|
||||
Self {
|
||||
changes: vec![],
|
||||
current_list_item: None,
|
||||
current_indent: None,
|
||||
x_pos: 0,
|
||||
wrap_width,
|
||||
screen_size,
|
||||
}
|
||||
}
|
||||
|
||||
fn emit_indent(&mut self) {
|
||||
if let Some(indent) = self.current_indent {
|
||||
let mut s = String::new();
|
||||
for _ in 0..indent {
|
||||
s.push(' ');
|
||||
}
|
||||
self.changes.push(s.into());
|
||||
self.x_pos += indent;
|
||||
}
|
||||
}
|
||||
|
||||
fn newline(&mut self) {
|
||||
self.changes.push("\r\n".into());
|
||||
self.x_pos = 0;
|
||||
}
|
||||
|
||||
fn wrap_text(&mut self, text: &str) {
|
||||
for word in text.split_word_bounds() {
|
||||
let len = unicode_column_width(word, None);
|
||||
if self.x_pos + len < self.wrap_width {
|
||||
if !(self.x_pos == 0 && is_whitespace_word(word)) {
|
||||
self.changes.push(word.into());
|
||||
self.x_pos += len;
|
||||
}
|
||||
} else if len < self.wrap_width {
|
||||
self.newline();
|
||||
self.emit_indent();
|
||||
if !is_whitespace_word(word) {
|
||||
self.changes.push(word.into());
|
||||
self.x_pos += len;
|
||||
}
|
||||
} else {
|
||||
self.newline();
|
||||
self.emit_indent();
|
||||
self.changes.push(word.into());
|
||||
self.newline();
|
||||
self.emit_indent();
|
||||
self.x_pos = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_event(&mut self, event: Event) {
|
||||
match event {
|
||||
Event::Start(Tag::Paragraph) => {}
|
||||
Event::End(Tag::Paragraph) => {
|
||||
self.newline();
|
||||
}
|
||||
|
||||
Event::Start(Tag::BlockQuote) => {}
|
||||
Event::End(Tag::BlockQuote) => {
|
||||
self.newline();
|
||||
}
|
||||
|
||||
Event::Start(Tag::CodeBlock(_)) => {}
|
||||
Event::End(Tag::CodeBlock(_)) => {
|
||||
self.newline();
|
||||
}
|
||||
|
||||
Event::Start(Tag::List(first_idx)) => {
|
||||
self.current_list_item = first_idx;
|
||||
self.newline();
|
||||
}
|
||||
Event::End(Tag::List(_)) => {
|
||||
self.newline();
|
||||
}
|
||||
|
||||
Event::Start(Tag::Item) => {
|
||||
let list_item_prefix = if let Some(idx) = self.current_list_item.take() {
|
||||
self.current_list_item.replace(idx + 1);
|
||||
format!(" {}. ", idx)
|
||||
} else {
|
||||
" * ".to_owned()
|
||||
};
|
||||
let indent_width = unicode_column_width(&list_item_prefix, None);
|
||||
self.current_indent.replace(indent_width);
|
||||
self.changes.push(list_item_prefix.into());
|
||||
self.x_pos += indent_width;
|
||||
}
|
||||
Event::End(Tag::Item) => {
|
||||
self.newline();
|
||||
self.current_indent.take();
|
||||
}
|
||||
|
||||
Event::Start(Tag::Heading(..)) => {
|
||||
self.newline();
|
||||
self.changes
|
||||
.push(AttributeChange::Intensity(Intensity::Bold).into());
|
||||
}
|
||||
Event::End(Tag::Heading(..)) => {
|
||||
self.changes
|
||||
.push(AttributeChange::Intensity(Intensity::Normal).into());
|
||||
self.newline();
|
||||
}
|
||||
|
||||
Event::Start(Tag::Strikethrough) => {
|
||||
self.changes
|
||||
.push(AttributeChange::StrikeThrough(true).into());
|
||||
}
|
||||
Event::End(Tag::Strikethrough) => {
|
||||
self.changes
|
||||
.push(AttributeChange::StrikeThrough(false).into());
|
||||
}
|
||||
|
||||
Event::Start(Tag::Emphasis) => {
|
||||
self.changes.push(AttributeChange::Italic(true).into());
|
||||
}
|
||||
Event::End(Tag::Emphasis) => {
|
||||
self.changes.push(AttributeChange::Italic(false).into());
|
||||
}
|
||||
|
||||
Event::Start(Tag::Link(_linktype, url, _title)) => {
|
||||
self.changes.push(
|
||||
AttributeChange::Hyperlink(Some(Arc::new(Hyperlink::new(url.into_string()))))
|
||||
.into(),
|
||||
);
|
||||
self.changes
|
||||
.push(AttributeChange::Underline(Underline::Single).into());
|
||||
}
|
||||
Event::End(Tag::Link(..)) => {
|
||||
self.changes.push(AttributeChange::Hyperlink(None).into());
|
||||
self.changes
|
||||
.push(AttributeChange::Underline(Underline::None).into());
|
||||
}
|
||||
|
||||
Event::Start(Tag::Image(_linktype, img_url, _title)) => {
|
||||
use termwiz::image::TextureCoordinate;
|
||||
|
||||
let url: &str = img_url.as_ref();
|
||||
if let Ok(mut f) = std::fs::File::open(url) {
|
||||
let mut data = vec![];
|
||||
if let Ok(_len) = f.read_to_end(&mut data) {
|
||||
if let Ok(decoded_image) = image::load_from_memory(&data) {
|
||||
let image = Arc::new(termwiz::image::ImageData::with_raw_data(data));
|
||||
|
||||
let scale = self.wrap_width as f32 / decoded_image.width() as f32;
|
||||
|
||||
let aspect_ratio =
|
||||
if self.screen_size.xpixel == 0 || self.screen_size.ypixel == 0 {
|
||||
// Guess: most monospace fonts are twice as tall as they are wide
|
||||
2.0
|
||||
} else {
|
||||
let cell_height = self.screen_size.ypixel as f32
|
||||
/ self.screen_size.rows as f32;
|
||||
let cell_width = self.screen_size.xpixel as f32
|
||||
/ self.screen_size.cols as f32;
|
||||
cell_height / cell_width
|
||||
};
|
||||
|
||||
let height = decoded_image.height() as f32 * scale / aspect_ratio;
|
||||
|
||||
self.newline();
|
||||
self.changes.push(termwiz::surface::Change::Image(
|
||||
termwiz::surface::Image {
|
||||
width: self.wrap_width,
|
||||
height: height as usize,
|
||||
top_left: TextureCoordinate::new_f32(0., 0.),
|
||||
bottom_right: TextureCoordinate::new_f32(1., 1.),
|
||||
image,
|
||||
},
|
||||
));
|
||||
self.newline();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Event::End(Tag::Image(_linktype, _img_url, _title)) => {}
|
||||
|
||||
Event::Start(Tag::Strong) => {
|
||||
self.changes
|
||||
.push(AttributeChange::Intensity(Intensity::Bold).into());
|
||||
}
|
||||
Event::End(Tag::Strong) => {
|
||||
self.changes
|
||||
.push(AttributeChange::Intensity(Intensity::Normal).into());
|
||||
}
|
||||
|
||||
Event::Start(Tag::FootnoteDefinition(_label)) => {}
|
||||
Event::End(Tag::FootnoteDefinition(_)) => {}
|
||||
|
||||
Event::Start(Tag::Table(_alignment)) => {}
|
||||
Event::End(Tag::Table(_)) => {}
|
||||
|
||||
Event::Start(Tag::TableHead) => {}
|
||||
Event::End(Tag::TableHead) => {}
|
||||
|
||||
Event::Start(Tag::TableRow) => {}
|
||||
Event::End(Tag::TableRow) => {}
|
||||
|
||||
Event::Start(Tag::TableCell) => {}
|
||||
Event::End(Tag::TableCell) => {}
|
||||
|
||||
Event::FootnoteReference(s) | Event::Text(s) | Event::Html(s) => {
|
||||
self.wrap_text(&s);
|
||||
}
|
||||
|
||||
Event::Code(s) => {
|
||||
self.changes
|
||||
.push(AttributeChange::Foreground(AnsiColor::Fuchsia.into()).into());
|
||||
self.wrap_text(&s);
|
||||
self.changes
|
||||
.push(AttributeChange::Foreground(Default::default()).into());
|
||||
}
|
||||
|
||||
Event::SoftBreak => {
|
||||
self.wrap_text(" ");
|
||||
}
|
||||
|
||||
Event::HardBreak => {
|
||||
self.newline();
|
||||
self.emit_indent();
|
||||
}
|
||||
|
||||
Event::Rule => {
|
||||
self.changes.push("---".into());
|
||||
self.newline();
|
||||
}
|
||||
|
||||
Event::TaskListMarker(true) => {
|
||||
self.changes.push("[x]".into());
|
||||
}
|
||||
|
||||
Event::TaskListMarker(false) => {
|
||||
self.changes.push("[ ]".into());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_str(&mut self, s: &str) {
|
||||
let mut options = Options::empty();
|
||||
options.insert(Options::ENABLE_STRIKETHROUGH);
|
||||
let parser = Parser::new_ext(s, options);
|
||||
|
||||
for event in parser {
|
||||
self.apply_event(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-287
@@ -3,21 +3,17 @@ use anyhow::anyhow;
|
||||
use config::{configuration, wezterm_version};
|
||||
use http_req::request::{HttpVersion, Request};
|
||||
use http_req::uri::Uri;
|
||||
use mux::connui::{ConnectionUI, ConnectionUIParams};
|
||||
use regex::Regex;
|
||||
use mux::connui::ConnectionUI;
|
||||
use serde::*;
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryFrom;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::Mutex;
|
||||
use std::time::Duration;
|
||||
use termwiz::cell::{AttributeChange, Hyperlink, Underline};
|
||||
use termwiz::cell::{Hyperlink, Underline};
|
||||
use termwiz::color::AnsiColor;
|
||||
use termwiz::escape::csi::{Cursor, Sgr};
|
||||
use termwiz::escape::osc::{ITermDimension, ITermFileData, ITermProprietary};
|
||||
use termwiz::escape::{OneBased, OperatingSystemCommand, CSI};
|
||||
use termwiz::surface::{Change, CursorVisibility};
|
||||
use wezterm_term::TerminalSize;
|
||||
use wezterm_toast_notification::*;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
@@ -29,17 +25,6 @@ pub struct Release {
|
||||
pub assets: Vec<Asset>,
|
||||
}
|
||||
|
||||
impl Release {
|
||||
pub fn classify_assets(&self) -> HashMap<AssetKind, Asset> {
|
||||
let mut map = HashMap::new();
|
||||
for asset in &self.assets {
|
||||
let kind = classify_asset_name(&asset.name);
|
||||
map.insert(kind, asset.clone());
|
||||
}
|
||||
map
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Asset {
|
||||
pub name: String,
|
||||
@@ -48,75 +33,6 @@ pub struct Asset {
|
||||
pub browser_download_url: String,
|
||||
}
|
||||
|
||||
pub type DistVers = String;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
pub enum AssetKind {
|
||||
SourceCode,
|
||||
AppImage,
|
||||
AppImageZSync,
|
||||
DebianDeb(DistVers),
|
||||
UbuntuDeb(DistVers),
|
||||
CentOSRpm(DistVers),
|
||||
FedoraRpm(DistVers),
|
||||
MacOSZip,
|
||||
WindowsZip,
|
||||
WindowsSetupExe,
|
||||
Unknown,
|
||||
}
|
||||
|
||||
fn classify_asset_name(name: &str) -> AssetKind {
|
||||
let winzip = Regex::new(r"WezTerm-windows-.*\.zip$").unwrap();
|
||||
let winsetup = Regex::new(r"WezTerm-.*-setup.exe$").unwrap();
|
||||
let maczip = Regex::new(r"WezTerm-macos-.*\.zip$").unwrap();
|
||||
let appimage = Regex::new(r"WezTerm-.*\.AppImage$").unwrap();
|
||||
let appimage_zsync = Regex::new(r"WezTerm-.*\.AppImage\.zsync$").unwrap();
|
||||
let source = Regex::new(r"wezterm-.*src\.tar\.gz$").unwrap();
|
||||
|
||||
let rpm = Regex::new(r"wezterm-.*-1\.([a-z]+)(\d+)\.x86_64\.rpm$").unwrap();
|
||||
for cap in rpm.captures_iter(name) {
|
||||
match &cap[1] {
|
||||
"fc" => return AssetKind::FedoraRpm(cap[2].to_string()),
|
||||
"el" => return AssetKind::CentOSRpm(cap[2].to_string()),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
let nightly_rpm = Regex::new(r"wezterm-nightly-(fedora|centos)(\d+)\.rpm$").unwrap();
|
||||
for cap in nightly_rpm.captures_iter(name) {
|
||||
match &cap[1] {
|
||||
"fedora" => return AssetKind::FedoraRpm(cap[2].to_string()),
|
||||
"centos" => return AssetKind::CentOSRpm(cap[2].to_string()),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
let dot_deb = Regex::new(r"wezterm-.*\.(Ubuntu|Debian)([0-9.]+)\.deb$").unwrap();
|
||||
for cap in dot_deb.captures_iter(name) {
|
||||
match &cap[1] {
|
||||
"Ubuntu" => return AssetKind::UbuntuDeb(cap[2].to_string()),
|
||||
"Debian" => return AssetKind::DebianDeb(cap[2].to_string()),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
if winzip.is_match(name) {
|
||||
AssetKind::WindowsZip
|
||||
} else if winsetup.is_match(name) {
|
||||
AssetKind::WindowsSetupExe
|
||||
} else if maczip.is_match(name) {
|
||||
AssetKind::MacOSZip
|
||||
} else if appimage.is_match(name) {
|
||||
AssetKind::AppImage
|
||||
} else if appimage_zsync.is_match(name) {
|
||||
AssetKind::AppImageZSync
|
||||
} else if source.is_match(name) {
|
||||
AssetKind::SourceCode
|
||||
} else {
|
||||
AssetKind::Unknown
|
||||
}
|
||||
}
|
||||
|
||||
fn get_github_release_info(uri: &str) -> anyhow::Result<Release> {
|
||||
let uri = Uri::try_from(uri)?;
|
||||
|
||||
@@ -149,117 +65,6 @@ lazy_static::lazy_static! {
|
||||
static ref UPDATER_WINDOW: Mutex<Option<ConnectionUI>> = Mutex::new(None);
|
||||
}
|
||||
|
||||
fn show_update_available(release: Release) {
|
||||
if !configuration().show_update_window {
|
||||
return;
|
||||
}
|
||||
let mut updater = UPDATER_WINDOW.lock().unwrap();
|
||||
|
||||
let size = TerminalSize {
|
||||
cols: 80,
|
||||
rows: 35,
|
||||
pixel_width: 0,
|
||||
pixel_height: 0,
|
||||
dpi: 0,
|
||||
};
|
||||
let ui = ConnectionUI::with_params(ConnectionUIParams {
|
||||
size,
|
||||
disable_close_delay: true,
|
||||
window_id: None,
|
||||
});
|
||||
ui.title("WezTerm Update Available");
|
||||
|
||||
let install = if cfg!(windows) {
|
||||
"https://wezfurlong.org/wezterm/install/windows.html"
|
||||
} else if cfg!(target_os = "macos") {
|
||||
"https://wezfurlong.org/wezterm/install/macos.html"
|
||||
} else if cfg!(target_os = "linux") {
|
||||
"https://wezfurlong.org/wezterm/install/linux.html"
|
||||
} else {
|
||||
"https://wezfurlong.org/wezterm/installation.html"
|
||||
};
|
||||
|
||||
let change_log = format!(
|
||||
"https://wezfurlong.org/wezterm/changelog.html#{}",
|
||||
release.tag_name
|
||||
);
|
||||
|
||||
let brief_blurb = release
|
||||
.body
|
||||
// The default for the release body is a series of newlines.
|
||||
// Trim that so that it doesn't make the window look weird
|
||||
.trim_end()
|
||||
// Normalize any dos line endings that might have wound
|
||||
// up in the body field...
|
||||
.replace("\r\n", "\n");
|
||||
|
||||
let mut render = crate::markdown::RenderState::new(
|
||||
78,
|
||||
termwiz::terminal::ScreenSize {
|
||||
cols: 80,
|
||||
rows: 35,
|
||||
xpixel: 0,
|
||||
ypixel: 0,
|
||||
},
|
||||
);
|
||||
render.parse_str(&brief_blurb);
|
||||
|
||||
let mut output = vec![
|
||||
Change::CursorVisibility(CursorVisibility::Hidden),
|
||||
Change::Attribute(AttributeChange::Underline(Underline::Single)),
|
||||
Change::Attribute(AttributeChange::Hyperlink(Some(Arc::new(Hyperlink::new(
|
||||
install,
|
||||
))))),
|
||||
format!("\r\nVersion {} is now available!\r\n", release.tag_name).into(),
|
||||
Change::Attribute(AttributeChange::Hyperlink(None)),
|
||||
Change::Attribute(AttributeChange::Underline(Underline::None)),
|
||||
format!("(this is version {})\r\n", wezterm_version()).into(),
|
||||
];
|
||||
output.append(&mut render.into_changes());
|
||||
output.extend_from_slice(&[
|
||||
"\r\n".into(),
|
||||
Change::Attribute(AttributeChange::Hyperlink(Some(Arc::new(Hyperlink::new(
|
||||
change_log,
|
||||
))))),
|
||||
Change::Attribute(AttributeChange::Underline(Underline::Single)),
|
||||
"View Change Log\r\n".into(),
|
||||
Change::Attribute(AttributeChange::Hyperlink(None)),
|
||||
]);
|
||||
ui.output(output);
|
||||
|
||||
let assets = release.classify_assets();
|
||||
let appimage = assets.get(&AssetKind::AppImage);
|
||||
let setupexe = assets.get(&AssetKind::WindowsSetupExe);
|
||||
|
||||
fn emit_direct_download_link(asset: &Option<&Asset>, ui: &ConnectionUI) {
|
||||
ui.output(vec![
|
||||
Change::Attribute(AttributeChange::Hyperlink(Some(Arc::new(Hyperlink::new(
|
||||
&asset.unwrap().browser_download_url,
|
||||
))))),
|
||||
Change::Attribute(AttributeChange::Underline(Underline::Single)),
|
||||
format!("Download {}\r\n", asset.unwrap().name).into(),
|
||||
Change::Attribute(AttributeChange::Hyperlink(None)),
|
||||
]);
|
||||
}
|
||||
|
||||
if cfg!(target_os = "linux") && std::env::var_os("APPIMAGE").is_some() && appimage.is_some() {
|
||||
emit_direct_download_link(&appimage, &ui);
|
||||
} else if cfg!(windows) && setupexe.is_some() {
|
||||
emit_direct_download_link(&setupexe, &ui);
|
||||
} else {
|
||||
ui.output(vec![
|
||||
Change::Attribute(AttributeChange::Hyperlink(Some(Arc::new(Hyperlink::new(
|
||||
install,
|
||||
))))),
|
||||
Change::Attribute(AttributeChange::Underline(Underline::Single)),
|
||||
"Open Download Page\r\n".into(),
|
||||
Change::Attribute(AttributeChange::Hyperlink(None)),
|
||||
]);
|
||||
}
|
||||
|
||||
updater.replace(ui);
|
||||
}
|
||||
|
||||
pub fn load_last_release_info_and_set_banner() {
|
||||
if !configuration().check_for_updates {
|
||||
return;
|
||||
@@ -397,7 +202,6 @@ fn update_checker() {
|
||||
"Click to see what's new",
|
||||
&url,
|
||||
);
|
||||
show_update_available(latest.clone());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,91 +236,3 @@ pub fn start_update_checker() {
|
||||
.expect("failed to spawn update checker thread");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn classify_names() {
|
||||
assert_eq!(
|
||||
classify_asset_name("WezTerm-windows-20200505-090057-31c6155f.zip"),
|
||||
AssetKind::WindowsZip
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("WezTerm-windows-nightly.zip"),
|
||||
AssetKind::WindowsZip
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("WezTerm-nightly-setup.exe"),
|
||||
AssetKind::WindowsSetupExe
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("WezTerm-20200505-090057-31c6155f-setup.exe"),
|
||||
AssetKind::WindowsSetupExe
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
classify_asset_name("WezTerm-macos-20200505-090057-31c6155f.zip"),
|
||||
AssetKind::MacOSZip
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("WezTerm-macos-nightly.zip"),
|
||||
AssetKind::MacOSZip
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
classify_asset_name("wezterm-20200505_090057_31c6155f-1.fc32.x86_64.rpm"),
|
||||
AssetKind::FedoraRpm("32".into())
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("wezterm-nightly-fedora32.rpm"),
|
||||
AssetKind::FedoraRpm("32".into())
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
classify_asset_name("wezterm-20200505_090057_31c6155f-1.fc31.x86_64.rpm"),
|
||||
AssetKind::FedoraRpm("31".into())
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("wezterm-20200505_090057_31c6155f-1.el8.x86_64.rpm"),
|
||||
AssetKind::CentOSRpm("8".into())
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("wezterm-20200505_090057_31c6155f-1.el7.x86_64.rpm"),
|
||||
AssetKind::CentOSRpm("7".into())
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("wezterm-20200505-090057-31c6155f.Ubuntu20.04.tar.xz"),
|
||||
AssetKind::Unknown
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("wezterm-20200505-090057-31c6155f.Ubuntu20.04.deb"),
|
||||
AssetKind::UbuntuDeb("20.04".into())
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("wezterm-20200505-090057-31c6155f.Ubuntu19.10.deb"),
|
||||
AssetKind::UbuntuDeb("19.10".into())
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("wezterm-20200505-090057-31c6155f.Debian9.12.deb"),
|
||||
AssetKind::DebianDeb("9.12".into())
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("wezterm-20200505-090057-31c6155f.Debian10.deb"),
|
||||
AssetKind::DebianDeb("10".into())
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("WezTerm-20200505-090057-31c6155f-Ubuntu16.04.AppImage.zsync"),
|
||||
AssetKind::AppImageZSync
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("WezTerm-20200505-090057-31c6155f-Ubuntu16.04.AppImage"),
|
||||
AssetKind::AppImage
|
||||
);
|
||||
assert_eq!(
|
||||
classify_asset_name("wezterm-20200505-090057-31c6155f-src.tar.gz"),
|
||||
AssetKind::SourceCode
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user