From 366543eef900a6a2c041606e6bd083dc1996b834 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Wed, 20 Jan 2021 09:01:05 +0100 Subject: sqv: Make generated documentation wrap nicely on most displays. --- sqv/build.rs | 2 +- sqv/src/sqv-usage.rs | 23 ++++++++++++++--------- sqv/src/sqv_cli.rs | 6 +++++- 3 files changed, 20 insertions(+), 11 deletions(-) (limited to 'sqv') diff --git a/sqv/build.rs b/sqv/build.rs index f96d7c8b..d638eea5 100644 --- a/sqv/build.rs +++ b/sqv/build.rs @@ -13,7 +13,7 @@ fn main() { // XXX: Revisit once // https://github.com/rust-lang/rust/issues/44732 is stabilized. - let mut sqv = sqv_cli::build(); + let mut sqv = sqv_cli::configure(clap::App::new("sqv").set_term_width(80)); let mut main = fs::File::create("src/sqv-usage.rs").unwrap(); dump_help(&mut main, &mut sqv, diff --git a/sqv/src/sqv-usage.rs b/sqv/src/sqv-usage.rs index 589d9a96..1838d6cd 100644 --- a/sqv/src/sqv-usage.rs +++ b/sqv/src/sqv-usage.rs @@ -15,20 +15,25 @@ //! //! OPTIONS: //! --keyring ... A keyring. Can be given multiple times. -//! --not-after Consider signatures created after TIMESTAMP as invalid. If a date is given, -//! 23:59:59 is used for the time. -//! [default: now] -//! --not-before Consider signatures created before TIMESTAMP as invalid. If a date is given, -//! 00:00:00 is used for the time. -//! [default: no constraint] -//! -n, --signatures The number of valid signatures to return success. Default: 1 +//! --not-after +//! Consider signatures created after TIMESTAMP as invalid. If a date +//! is given, 23:59:59 is used for the time. +//! [default: now] +//! --not-before +//! Consider signatures created before TIMESTAMP as invalid. If a date +//! is given, 00:00:00 is used for the time. +//! [default: no constraint] +//! -n, --signatures +//! The number of valid signatures to return success. Default: 1 +//! //! //! ARGS: //! File containing the detached signature. //! File to verify. //! -//! TIMESTAMPs must be given in ISO 8601 format (e.g. '2017-03-04T13:25:35Z', '2017-03-04T13:25', '20170304T1325+0830', -//! '2017-03-04', '2017031', ...). If no timezone is specified, UTC is assumed. +//! TIMESTAMPs must be given in ISO 8601 format (e.g. '2017-03-04T13:25:35Z', '2017- +//! 03-04T13:25', '20170304T1325+0830', '2017-03-04', '2017031', ...). If no +//! timezone is specified, UTC is assumed. //! ``` #![doc(html_favicon_url = "https://docs.sequoia-pgp.org/favicon.png")] diff --git a/sqv/src/sqv_cli.rs b/sqv/src/sqv_cli.rs index 8b85dc92..1391924f 100644 --- a/sqv/src/sqv_cli.rs +++ b/sqv/src/sqv_cli.rs @@ -4,7 +4,11 @@ use clap::{App, Arg, AppSettings}; // The argument parser. pub fn build() -> App<'static, 'static> { - App::new("sqv") + configure(App::new("sqv")) +} + +pub fn configure(app: App<'static, 'static>) -> App<'static, 'static> { + app .version(env!("CARGO_PKG_VERSION")) .about("sqv is a command-line OpenPGP signature verification tool.") .setting(AppSettings::ArgRequiredElseHelp) -- cgit v1.2.3