Skip to content

Commit

Permalink
feat: colored help message
Browse files Browse the repository at this point in the history
  • Loading branch information
wfxr committed Dec 28, 2024
1 parent 69e311e commit d08efb0
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-yaml
Expand Down
46 changes: 23 additions & 23 deletions completions/powershell/_csview.ps1

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

14 changes: 7 additions & 7 deletions completions/zsh/_csview

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

23 changes: 19 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
use std::path::PathBuf;

use clap::{Parser, ValueEnum, ValueHint};
use clap::ValueHint;
use clap::{
builder::{
styling::{AnsiColor, Effects},
Styles,
},
Parser, ValueEnum,
};

#[derive(Parser)]
#[command(about, version)]
#[command(disable_help_subcommand = true)]
#[command(next_line_help = true)]
#[clap(about, version)]
#[clap(disable_help_subcommand = true)]
#[clap(next_line_help = true)]
#[clap(
styles(Styles::styled()
.header(AnsiColor::Yellow.on_default() | Effects::BOLD)
.usage(AnsiColor::Yellow.on_default() | Effects::BOLD)
.literal(AnsiColor::Green.on_default() | Effects::BOLD)
.placeholder(AnsiColor::Cyan.on_default())
)
)]
pub struct App {
/// File to view.
#[arg(name = "FILE", value_hint = ValueHint::FilePath)]
Expand Down
2 changes: 1 addition & 1 deletion src/table/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl<'a> FromIterator<&'a str> for Row<'a> {
}
}

impl<'a> Row<'a> {
impl Row<'_> {
pub fn write<T: Write>(&self, wtr: &mut T, fmt: &Style, widths: &[usize], align: Alignment) -> Result<()> {
let sep = fmt.colseps.mid.map(|c| c.to_string()).unwrap_or_default();
write!(wtr, "{:indent$}", "", indent = fmt.indent)?;
Expand Down

0 comments on commit d08efb0

Please sign in to comment.