File: 0003-New-command-sq-git-version.patch

package info (click to toggle)
rust-sequoia-git 0.4.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,580 kB
  • sloc: sh: 367; makefile: 32
file content (68 lines) | stat: -rw-r--r-- 1,995 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From 4e1efcceb97e565bc1f3232361122804b9a36a3f Mon Sep 17 00:00:00 2001
From: "Neal H. Walfield" <neal@sequoia-pgp.org>
Date: Tue, 1 Apr 2025 09:33:07 +0200
Subject: [PATCH 3/5] New command sq-git version.

  - Add a command to display some version information.
---
 NEWS           | 4 ++++
 src/cli/mod.rs | 9 ++++++++-
 src/main.rs    | 7 +++++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 94d0401..fa879da 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@
 #+TITLE: sequoia-git NEWS – history of user-visible changes
 #+STARTUP: content hidestars
 
+* Changes in 0.4.1
+** New functionality
+   - New command `sq-git version` displays `sq-git`'s version
+     information.
 * Changes in 0.4.0
 ** New functionality
    This release adds support for RFC 9580.
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 6561f34..33ad5c2 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -743,7 +743,14 @@ pub enum Subcommand {
         /// Supplied as third argument to the update hook, see
         /// `githooks(5)`.
         new_object: String,
-    }
+    },
+
+    /// Detailed version and output version information
+    ///
+    /// With no further options, this command lists the version of
+    /// `sq-git`, the version of the underlying OpenPGP implementation
+    /// `sequoia-openpgp`, and which cryptographic library it uses.
+    Version,
 }
 
 #[derive(clap::Args, Debug)]
diff --git a/src/main.rs b/src/main.rs
index 6247fb6..80a44cc 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -721,6 +721,13 @@ fn main() -> anyhow::Result<()> {
             let _ = cache.persist();
             result?;
         },
+
+        cli::Subcommand::Version=> {
+            eprintln!("sq-git {}", env!("CARGO_PKG_VERSION"));
+            eprintln!("using sequoia-openpgp {}", sequoia_openpgp::VERSION);
+            eprintln!("with cryptographic backend {}",
+                      sequoia_openpgp::crypto::backend());
+        }
     }
     Ok(())
 }
-- 
2.43.0