From 1db1d4d6d23248374683276b943da06cc50fd602 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 12 Feb 2026 23:21:38 +0300 Subject: [PATCH] cli: wire `get_site_url` in inspect; fix clippy in `remote_update` Signed-off-by: NotAShelf Change-Id: Ifdbc34dd7a5a51edc5dff326eac095516a6a6964 --- src/cli/commands/inspect.rs | 35 ++++++++++++++++++++++--------- src/cli/commands/remote_update.rs | 4 ++-- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/cli/commands/inspect.rs b/src/cli/commands/inspect.rs index 7ed263d..75378e0 100644 --- a/src/cli/commands/inspect.rs +++ b/src/cli/commands/inspect.rs @@ -176,7 +176,7 @@ fn display_project_inspection( // Display project files println!(); - display_project_files(&project.files)?; + display_project_files(&project.files, project)?; // Display properties println!(); @@ -228,7 +228,10 @@ fn display_project_header(project: &Project) -> Result<()> { Ok(()) } -fn display_project_files(files: &[ProjectFile]) -> Result<()> { +fn display_project_files( + files: &[ProjectFile], + project: &Project, +) -> Result<()> { if files.is_empty() { println!("{}", "No files available".yellow()); return Ok(()); @@ -250,19 +253,31 @@ fn display_project_files(files: &[ProjectFile]) -> Result<()> { format!(" {status}") }; - // File path line + // File path line with optional site URL let file_path = format!("{}={}", file.file_type, file.file_name); - table.add_row(vec![ - Cell::new(format!("{file_path}:{status_text}")).fg(if idx == 0 { - Color::Green - } else { - Color::White - }), - ]); + let file_display = if let Some(site_url) = file.get_site_url(project) { + // Create hyperlink for the file + let hyperlink = crate::ui_utils::hyperlink(&site_url, &file_path); + format!("{hyperlink}:{status_text}") + } else { + format!("{file_path}:{status_text}") + }; + + table.add_row(vec![Cell::new(file_display).fg(if idx == 0 { + Color::Green + } else { + Color::White + })]); // Date published table.add_row(vec![Cell::new(&file.date_published).fg(Color::DarkGrey)]); + // Show site URL if available (for non-hyperlink terminals) + if let Some(site_url) = file.get_site_url(project) { + table + .add_row(vec![Cell::new(format!("URL: {site_url}")).fg(Color::Blue)]); + } + // Empty line table.add_row(vec![Cell::new("")]); diff --git a/src/cli/commands/remote_update.rs b/src/cli/commands/remote_update.rs index a4ddbba..873dbe9 100644 --- a/src/cli/commands/remote_update.rs +++ b/src/cli/commands/remote_update.rs @@ -1,4 +1,4 @@ -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use crate::{cli::RemoteUpdateArgs, error::PakkerError, git, model::Config}; @@ -71,7 +71,7 @@ pub async fn execute(args: RemoteUpdateArgs) -> Result<(), PakkerError> { } /// Sync override files from remote directory to current directory -async fn sync_overrides(remote_dir: &PathBuf) -> Result<(), PakkerError> { +async fn sync_overrides(remote_dir: &Path) -> Result<(), PakkerError> { let remote_config_path = remote_dir.join("pakku.json"); if !remote_config_path.exists() { return Ok(());