Skip to content

Commit cc8d008

Browse files
committed
reserve 50 characters for the config name
1 parent 1ecc96d commit cc8d008

File tree

2 files changed

+10
-47
lines changed

2 files changed

+10
-47
lines changed

Diff for: Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ tracing = { version = "0.1.37", optional = true }
189189
# for progress
190190
owo-colors = "4.0.0"
191191

192-
# for config-tree
193-
# terminal_size = "0.3.0"
194192

195193
# Avoid pre-compiled binaries, see https://github.com/serde-rs/serde/issues/2538 and https://github.com/serde-rs/serde/pull/2590
196194
serde_derive = ">=1.0.185"

Diff for: src/plumbing/progress.rs

+10-45
Original file line numberDiff line numberDiff line change
@@ -67,36 +67,6 @@ struct Record {
6767
usage: Usage,
6868
}
6969

70-
// TODO implement this without table, how hard is it?
71-
72-
// impl Tabled for Record {
73-
// const LENGTH: usize = 3;
74-
75-
// fn fields(&self) -> Vec<Cow<'_, str>> {
76-
// let mut tokens = self.config.split('.');
77-
// let mut buf = vec![{
78-
// let name = tokens.next().expect("present");
79-
// if name == "gitoxide" {
80-
// name.bold().green()
81-
// } else {
82-
// name.bold()
83-
// }
84-
// .to_string()
85-
// }];
86-
// buf.extend(tokens.map(ToOwned::to_owned));
87-
88-
// vec![
89-
// Cow::Borrowed(self.usage.icon()),
90-
// buf.join(".").into(),
91-
// self.usage.to_string().into(),
92-
// ]
93-
// }
94-
95-
// fn headers() -> Vec<Cow<'static, str>> {
96-
// vec!["icon".into(), "key".into(), "info".into()]
97-
// }
98-
// }
99-
10070
static GIT_CONFIG: &[Record] = &[
10171
Record {
10272
config: "core.symlinks",
@@ -571,22 +541,17 @@ pub fn show_progress() -> anyhow::Result<()> {
571541
.count()
572542
)?;
573543

574-
// TODO implement this without table, how hard is it?
575-
576-
// let mut table = tabled::Table::new(sorted);
577-
// let table = table.with(Style::blank()).with(Extract::rows(1..));
578-
// println!(
579-
// "{}",
580-
// if let Some((terminal_size::Width(w), _)) = terminal_size::terminal_size() {
581-
// table.with(Width::wrap(w as usize).keep_words().priority::<PriorityMax>())
582-
// } else {
583-
// table
584-
// }
585-
// );
586-
587-
// noted: reverted from https://github.com/Byron/gitoxide/commit/65e64964c7cd151e53e5a7d4b9ba8fabda1c0e16
588544
for Record { config, usage } in sorted {
589-
println!("{} {}: {usage}", usage.icon(), config.bold(),);
545+
println!(
546+
"{icon} {config: <50}: {usage}",
547+
icon = usage.icon(),
548+
config = if let Some(config) = config.strip_prefix("gitoxide.") {
549+
format!("{gitoxide}{config}", gitoxide = "gitoxide.".green())
550+
} else {
551+
config.to_string()
552+
}
553+
.bold(),
554+
);
590555
}
591556

592557
println!("{buf}");

0 commit comments

Comments
 (0)