git_warp_time/
cli.rs

1// SPDX-FileCopyrightText: © 2021 Caleb Maclennan <caleb@alerque.com>
2// SPDX-License-Identifier: GPL-3.0-only
3
4use clap::builder::styling::{AnsiColor, Styles};
5use clap::Parser;
6
7/// CLI utility that resets the timestamps of files in a Git repository working directory
8/// to the exact timestamp of the last commit which modified each file.
9#[derive(Parser, Debug)]
10#[command(author, bin_name = "git-warp-time")]
11pub struct Cli {
12    /// Include files tracked by Git but modifications in the working tee
13    #[arg(short, long)]
14    pub dirty: bool,
15
16    /// Include files tracked by Git but also ignored
17    #[arg(short, long)]
18    pub ignored: bool,
19
20    /// Only touch files that are newer than their history, ignore ones that are older
21    #[arg(short = 'o', long)]
22    pub ignore_older: bool,
23
24    /// Don't print any output about files touched or skipped
25    #[arg(short, long)]
26    pub quiet: bool,
27
28    /// Optional list of paths to operate on instead of default which is all files tracked by Git
29    #[arg(value_hint = clap::ValueHint::FilePath)]
30    pub paths: Option<Vec<String>>,
31}
32
33pub const STYLES: Styles = Styles::styled()
34    .header(AnsiColor::Magenta.on_default().bold())
35    .usage(AnsiColor::Yellow.on_default().bold())
36    .literal(AnsiColor::BrightCyan.on_default().bold())
37    .placeholder(AnsiColor::Cyan.on_default())
38    .error(AnsiColor::BrightRed.on_default().bold())
39    .valid(AnsiColor::BrightGreen.on_default().bold())
40    .invalid(AnsiColor::BrightYellow.on_default().bold());