From c74c2ca432cb5cb542caef1499b2ed1db6050a53 Mon Sep 17 00:00:00 2001 From: Thaumy Date: Tue, 12 Sep 2023 16:07:35 +0800 Subject: [PATCH] ui(list news): display url and hide id --- src/display/colorful.rs | 8 ++------ src/display/normal.rs | 3 ++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/display/colorful.rs b/src/display/colorful.rs index 8d89c37..2aa9633 100644 --- a/src/display/colorful.rs +++ b/src/display/colorful.rs @@ -212,12 +212,8 @@ pub fn list_news(news_list: &Result>, rev: bool) { .map(|dt| dt.format("%m-%d %H:%M").to_string()) .unwrap(); - println!( - "{} {} {}", - create_time.dimmed(), - "#".dimmed(), - news.id.to_string().dimmed() - ); + let url = format!("https://news.cnblogs.com/n/{}", news.id); + println!("{} {}", create_time.dimmed(), url.dimmed(),); println!(" {}", news.title); println!(" {}{}", news.summary.dimmed(), "...".dimmed()); println!(); diff --git a/src/display/normal.rs b/src/display/normal.rs index e7a0b22..c87cb0e 100644 --- a/src/display/normal.rs +++ b/src/display/normal.rs @@ -210,7 +210,8 @@ pub fn list_news(news_list: &Result>, rev: bool) { .map(|dt| dt.format("%m-%d %H:%M").to_string()) .unwrap(); - println!("{} # {}", create_time, news.id); + let url = format!("https://news.cnblogs.com/n/{}", news.id); + println!("{} {}", create_time, url); println!(" {}", news.title); println!(" {}...", news.summary); println!();