summaryrefslogtreecommitdiffstats
path: root/tool
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-05-11 17:00:59 +0200
committerJustus Winter <justus@sequoia-pgp.org>2018-05-11 17:00:59 +0200
commit9fc989c9e1e6e3c700059346ca205235d6dbf7a0 (patch)
tree3b8569365660a6953bc2b4726d3bbbeae08c31b0 /tool
parent4fd637775c0d66206ddf2e6652fe8402469bb7ee (diff)
tool: Generalize usage generation and document 'sqv'.
Diffstat (limited to 'tool')
-rw-r--r--tool/Cargo.toml4
-rw-r--r--tool/Makefile13
-rw-r--r--tool/make-usage.sh6
-rw-r--r--tool/src/sq-usage.rs (renamed from tool/src/usage.rs)2
-rw-r--r--tool/src/sq.rs (renamed from tool/src/main.rs)0
-rw-r--r--tool/src/sqv-usage.rs25
6 files changed, 36 insertions, 14 deletions
diff --git a/tool/Cargo.toml b/tool/Cargo.toml
index 6ac34aab..c954630d 100644
--- a/tool/Cargo.toml
+++ b/tool/Cargo.toml
@@ -20,8 +20,8 @@ clap = "2.27.1"
[[bin]]
name = "sq"
-path = "src/usage.rs"
+path = "src/sq-usage.rs"
[[bin]]
name = "sqv"
-path = "src/sqv.rs"
+path = "src/sqv-usage.rs"
diff --git a/tool/Makefile b/tool/Makefile
index 517f705e..7cd3bd1f 100644
--- a/tool/Makefile
+++ b/tool/Makefile
@@ -1,13 +1,10 @@
CARGO ?= cargo
SQ ?= ../target/debug/sq
+SQV ?= ../target/debug/sqv
-all: sq src/usage.rs
+all: src/sq-usage.rs src/sqv-usage.rs
-sq: ../target/debug/sq
-
-.PHONY: ../target/debug/sq
-../target/debug/sq:
- $(CARGO) build
-
-src/usage.rs: make-usage.sh $(SQ)
+src/sq-usage.rs: make-usage.sh $(SQ)
sh make-usage.sh $(SQ) >$@
+src/sqv-usage.rs: make-usage.sh $(SQV)
+ sh make-usage.sh $(SQV) >$@
diff --git a/tool/make-usage.sh b/tool/make-usage.sh
index c9c890a2..bec96386 100644
--- a/tool/make-usage.sh
+++ b/tool/make-usage.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-sq=$1
+tool=$1
quote() {
sed 's@^@//! @' | sed 's/ $//'
@@ -23,7 +23,7 @@ dump_help() { # subcommand, indention
printf "\n$2 Subcommand$1\n\n"
fi
- help="`$sq $1 --help`"
+ help="`$tool $1 --help`"
begin_code
printf "$help\n" | tail -n +2
@@ -50,4 +50,4 @@ dump_help() { # subcommand, indention
dump_help
) | quote
-printf '\ninclude!("main.rs");\n'
+printf '\ninclude!("'"$(basename $tool)"'.rs");\n'
diff --git a/tool/src/usage.rs b/tool/src/sq-usage.rs
index b0c76132..82a7d4b6 100644
--- a/tool/src/usage.rs
+++ b/tool/src/sq-usage.rs
@@ -381,4 +381,4 @@
//! <LABEL> Label to use
//! ```
-include!("main.rs");
+include!("sq.rs");
diff --git a/tool/src/main.rs b/tool/src/sq.rs
index 50eab105..50eab105 100644
--- a/tool/src/main.rs
+++ b/tool/src/sq.rs
diff --git a/tool/src/sqv-usage.rs b/tool/src/sqv-usage.rs
new file mode 100644
index 00000000..54f5a0af
--- /dev/null
+++ b/tool/src/sqv-usage.rs
@@ -0,0 +1,25 @@
+//! A command-line frontend for Sequoia.
+//!
+//! # Usage
+//!
+//! ```text
+//! sqv is a command-line OpenPGP signature verification tool.
+//!
+//! USAGE:
+//! sqv [FLAGS] [OPTIONS] <SIG-FILE> <FILE> --keyring <FILE>...
+//!
+//! FLAGS:
+//! -h, --help Prints help information
+//! --trace Trace execution.
+//! -V, --version Prints version information
+//!
+//! OPTIONS:
+//! -r, --keyring <FILE>... A keyring
+//! -n, --signatures <N> The number of valid signatures to return success. Default: 1
+//!
+//! ARGS:
+//! <SIG-FILE> File containing the detached signature.
+//! <FILE> File to verify.
+//! ```
+
+include!("sqv.rs");