rust/rhg/src/commands/files.rs
changeset 49639 37bc3edef76f
parent 48453 9b0e1f64656f
child 49978 e43f91244de2
--- a/rust/rhg/src/commands/files.rs	Mon Nov 14 17:18:56 2022 +0100
+++ b/rust/rhg/src/commands/files.rs	Tue Nov 15 00:02:43 2022 +0100
@@ -14,15 +14,14 @@
 Returns 0 on success.
 ";
 
-pub fn args() -> clap::App<'static, 'static> {
-    clap::SubCommand::with_name("files")
+pub fn args() -> clap::Command {
+    clap::command!("files")
         .arg(
-            Arg::with_name("rev")
+            Arg::new("rev")
                 .help("search the repository as it is in REV")
-                .short("-r")
-                .long("--revision")
-                .value_name("REV")
-                .takes_value(true),
+                .short('r')
+                .long("revision")
+                .value_name("REV"),
         )
         .about(HELP_TEXT)
 }
@@ -35,7 +34,7 @@
         ));
     }
 
-    let rev = invocation.subcommand_args.value_of("rev");
+    let rev = invocation.subcommand_args.get_one::<String>("rev");
 
     let repo = invocation.repo?;
 
@@ -57,7 +56,8 @@
                 "rhg files -r <rev> is not supported in narrow clones",
             ));
         }
-        let files = list_rev_tracked_files(repo, rev).map_err(|e| (e, rev))?;
+        let files = list_rev_tracked_files(repo, rev)
+            .map_err(|e| (e, rev.as_ref()))?;
         display_files(invocation.ui, repo, files.iter())
     } else {
         // The dirstate always reflects the sparse narrowspec, so if