diff --git a/Cargo.lock b/Cargo.lock index b85760a3..f27863a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,6 +41,25 @@ dependencies = [ "libc", ] +[[package]] +name = "ansi-str" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cf4578926a981ab0ca955dc023541d19de37112bc24c1a197bd806d3d86ad1d" +dependencies = [ + "ansitok", +] + +[[package]] +name = "ansitok" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "220044e6a1bb31ddee4e3db724d29767f352de47445a6cd75e1a173142136c83" +dependencies = [ + "nom", + "vte", +] + [[package]] name = "anstream" version = "0.5.0" @@ -95,6 +114,12 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + [[package]] name = "async-trait" version = "0.1.73" @@ -1079,6 +1104,8 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2ccbe15f2b6db62f9a9871642746427e297b0ceb85f9a7f1ee5ff47d184d0c8" dependencies = [ + "ansi-str", + "ansitok", "bytecount", "fnv", "unicode-width", @@ -1625,6 +1652,8 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfe9c3632da101aba5131ed63f9eed38665f8b3c68703a6bb18124835c1a5d22" dependencies = [ + "ansi-str", + "ansitok", "papergrid", "tabled_derive", "unicode-width", @@ -1964,6 +1993,27 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "vte" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cbce692ab4ca2f1f3047fcf732430249c0e971bfdd2b234cf2c47ad93af5983" +dependencies = [ + "arrayvec", + "utf8parse", + "vte_generate_state_changes", +] + +[[package]] +name = "vte_generate_state_changes" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff" +dependencies = [ + "proc-macro2", + "quote", +] + [[package]] name = "want" version = "0.3.1" diff --git a/Cargo.toml b/Cargo.toml index 3217a85a..39f47ccf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ reqwest = { version = "0.11", default-features = false, features = [ semver = { version = "1.0.18", default-features = false, features = ["serde"] } serde = { version = "1.0.188", default-features = false, features = ["derive"] } serde_json = "1.0.105" -tabled = "0.14.0" +tabled = { version = "0.14.0", features = ["color"] } thiserror = { version = "1.0.44", default-features = false } tokio = { version = "1.30.0", default-features = false, features = ["full"] } tracing = "0.1.37" diff --git a/src/cli/cmd/list.rs b/src/cli/cmd/list.rs index 77bee99e..36ad18f7 100644 --- a/src/cli/cmd/list.rs +++ b/src/cli/cmd/list.rs @@ -1,6 +1,6 @@ use clap::{Parser, Subcommand}; use indicatif::{ProgressBar, ProgressStyle}; -use owo_colors::{OwoColorize, styles::DimDisplay}; +use owo_colors::OwoColorize; use serde::{Deserialize, Serialize}; use std::io::IsTerminal; use std::process::ExitCode; @@ -270,8 +270,9 @@ fn string_has_whitespace(s: &str) -> bool { #[derive(Tabled, serde::Serialize)] struct OrgRow { + #[tabled(display_with = "bold")] organization: String, - #[tabled(rename = "FlakeHub URL")] + #[tabled(rename = "FlakeHub URL", display_with = "dimmed")] flakehub_url: Url, } @@ -297,9 +298,11 @@ impl From for OrgRow { #[derive(Tabled, serde::Serialize)] struct VersionRow { + #[tabled(rename = "Simplified version", display_with = "bold")] simplified_version: semver::Version, - #[tabled(rename = "FlakeHub URL")] + #[tabled(rename = "FlakeHub URL", display_with = "dimmed")] flakehub_url: Url, + #[tabled(rename = "Full version", display_with = "dimmed")] full_version: semver::Version, } diff --git a/src/cli/cmd/mod.rs b/src/cli/cmd/mod.rs index da054635..127b3182 100644 --- a/src/cli/cmd/mod.rs +++ b/src/cli/cmd/mod.rs @@ -12,7 +12,7 @@ use once_cell::sync::Lazy; use reqwest::Client as HttpClient; use serde::Serialize; use tabled::settings::{ - style::{HorizontalLine, HorizontalLineIter, On, VerticalLine, VerticalLineIter}, + style::{HorizontalLine, On, VerticalLineIter}, Style, }; @@ -29,10 +29,16 @@ const DEFAULT_STYLE: Lazy< On, (), (), - HorizontalLineIter>, + [HorizontalLine; 1], VerticalLineIter>, >, -> = Lazy::new(|| Style::ascii().remove_vertical().remove_horizontal()); +> = Lazy::new(|| Style::ascii() + .remove_vertical() + .remove_horizontal() + .horizontals([HorizontalLine::new(1, Style::modern().get_horizontal()) + .main(Some('-')) + .intersection(None)]) +); #[async_trait::async_trait] pub trait CommandExecute {