Skip to content

Commit

Permalink
Make styling correct
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoverbear committed Nov 6, 2023
1 parent 5b29bfa commit 79453d9
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 7 deletions.
50 changes: 50 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 6 additions & 3 deletions src/cli/cmd/list.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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,
}

Expand All @@ -297,9 +298,11 @@ impl From<Org> 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,
}

Expand Down
12 changes: 9 additions & 3 deletions src/cli/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand All @@ -29,10 +29,16 @@ const DEFAULT_STYLE: Lazy<
On,
(),
(),
HorizontalLineIter<std::array::IntoIter<HorizontalLine, 0>>,
[HorizontalLine; 1],
VerticalLineIter<std::array::IntoIter<tabled::settings::style::VerticalLine, 0>>,
>,
> = 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 {
Expand Down

0 comments on commit 79453d9

Please sign in to comment.