cli: wire get_site_url in inspect; fix clippy in remote_update
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ifdbc34dd7a5a51edc5dff326eac095516a6a6964
This commit is contained in:
parent
4079485179
commit
1db1d4d6d2
2 changed files with 27 additions and 12 deletions
|
|
@ -176,7 +176,7 @@ fn display_project_inspection(
|
||||||
|
|
||||||
// Display project files
|
// Display project files
|
||||||
println!();
|
println!();
|
||||||
display_project_files(&project.files)?;
|
display_project_files(&project.files, project)?;
|
||||||
|
|
||||||
// Display properties
|
// Display properties
|
||||||
println!();
|
println!();
|
||||||
|
|
@ -228,7 +228,10 @@ fn display_project_header(project: &Project) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_project_files(files: &[ProjectFile]) -> Result<()> {
|
fn display_project_files(
|
||||||
|
files: &[ProjectFile],
|
||||||
|
project: &Project,
|
||||||
|
) -> Result<()> {
|
||||||
if files.is_empty() {
|
if files.is_empty() {
|
||||||
println!("{}", "No files available".yellow());
|
println!("{}", "No files available".yellow());
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|
@ -250,19 +253,31 @@ fn display_project_files(files: &[ProjectFile]) -> Result<()> {
|
||||||
format!(" {status}")
|
format!(" {status}")
|
||||||
};
|
};
|
||||||
|
|
||||||
// File path line
|
// File path line with optional site URL
|
||||||
let file_path = format!("{}={}", file.file_type, file.file_name);
|
let file_path = format!("{}={}", file.file_type, file.file_name);
|
||||||
table.add_row(vec![
|
let file_display = if let Some(site_url) = file.get_site_url(project) {
|
||||||
Cell::new(format!("{file_path}:{status_text}")).fg(if idx == 0 {
|
// 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
|
Color::Green
|
||||||
} else {
|
} else {
|
||||||
Color::White
|
Color::White
|
||||||
}),
|
})]);
|
||||||
]);
|
|
||||||
|
|
||||||
// Date published
|
// Date published
|
||||||
table.add_row(vec![Cell::new(&file.date_published).fg(Color::DarkGrey)]);
|
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
|
// Empty line
|
||||||
table.add_row(vec![Cell::new("")]);
|
table.add_row(vec![Cell::new("")]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use std::path::PathBuf;
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use crate::{cli::RemoteUpdateArgs, error::PakkerError, git, model::Config};
|
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
|
/// 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");
|
let remote_config_path = remote_dir.join("pakku.json");
|
||||||
if !remote_config_path.exists() {
|
if !remote_config_path.exists() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue