equal
deleted
inserted
replaced
|
1 use clap::Arg; |
|
2 use hg::matchers::ReSyntax; |
|
3 |
|
4 use crate::error::CommandError; |
|
5 |
|
6 use super::debugignorerhg::WhichPatterns; |
|
7 |
|
8 pub const HELP_TEXT: &str = " |
|
9 Show effective hgignore patterns used by rhg. |
|
10 |
|
11 This is a pure Rust version of `hg debugignore`. |
|
12 |
|
13 Some options might be missing, check the list below. |
|
14 "; |
|
15 |
|
16 pub fn args() -> clap::Command { |
|
17 clap::command!("script::hgignore") |
|
18 .arg( |
|
19 Arg::new("print-re") |
|
20 .help("Print the regular expression that matches all ignored files.") |
|
21 .action(clap::ArgAction::SetTrue) |
|
22 .long("print-re"), |
|
23 ).about(HELP_TEXT) |
|
24 } |
|
25 |
|
26 pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { |
|
27 let repo = invocation.repo?; |
|
28 let args = invocation.subcommand_args; |
|
29 let print_re = args.get_flag("print-re"); |
|
30 if !print_re { |
|
31 return Err(CommandError::unsupported( |
|
32 "Unsupported invocation: flag --print-re is required", |
|
33 )); |
|
34 } |
|
35 |
|
36 crate::commands::debugignorerhg::work( |
|
37 repo, |
|
38 invocation.ui, |
|
39 WhichPatterns::All, |
|
40 ReSyntax::Tidy, |
|
41 ) |
|
42 } |