Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Upcoming release

## Features

- Add colors to `--help`, see #1846 (@starsep)

## Bugfixes

Expand Down
9 changes: 9 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use std::path::{Path, PathBuf};
use std::time::Duration;

use anyhow::anyhow;
use clap::builder::Styles;
use clap::builder::styling::{AnsiColor, Effects};
use clap::{
Arg, ArgAction, ArgGroup, ArgMatches, Command, Parser, ValueEnum, error::ErrorKind,
value_parser,
Expand All @@ -18,6 +20,12 @@ use crate::filesystem;
use crate::filter::OwnerFilter;
use crate::filter::SizeFilter;

const STYLES: Styles = Styles::styled()
.header(AnsiColor::Green.on_default().effects(Effects::BOLD))
.usage(AnsiColor::Green.on_default().effects(Effects::BOLD))
.literal(AnsiColor::Cyan.on_default().effects(Effects::BOLD))
.placeholder(AnsiColor::Cyan.on_default());

#[derive(Parser)]
#[command(
name = "fd",
Expand All @@ -28,6 +36,7 @@ use crate::filter::SizeFilter;
args_override_self = true,
group(ArgGroup::new("execs").args(&["exec", "exec_batch", "list_details"]).conflicts_with_all(&[
"max_results", "quiet", "max_one_result"])),
styles = STYLES,
)]
pub struct Opts {
/// Include hidden directories and files in the search results (default:
Expand Down