Skip to content

Commit b3762fc

Browse files
committed
feat: add title option
1 parent c25a39e commit b3762fc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ struct Opt {
3131
/// Print autocompletion script for your shell
3232
#[arg(long = "generate", value_enum)]
3333
generator: Option<clap_complete::Shell>,
34+
/// Title
35+
#[arg(short, long)]
36+
title: Option<String>,
3437
}
3538

3639
fn main() -> anyhow::Result<ExitCode> {
@@ -146,6 +149,9 @@ where
146149
write!(writer, "\x1B[2J\x1B[H").unwrap(); // clear
147150
#[cfg(debug_assertions)]
148151
write!(writer, "num lines: {num_lines:?} ").unwrap();
152+
if let Some(title) = &opt.title {
153+
writeln!(writer, "{}", title).unwrap();
154+
}
149155
writeln!(writer, "· Elapsed time: {}", Format(start.elapsed())).unwrap();
150156
writeln!(writer, "╭─").unwrap();
151157
for line in output_lines.iter().take(num_lines) {

0 commit comments

Comments
 (0)