Add manpage generation
Forked `structopt-derive` to https://github.com/epilys/structopt-derive-manpagepull/1/head
parent
46897c15a2
commit
ae9d5c4d78
|
@ -794,12 +794,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.3.3"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
|
||||
dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
|
@ -1832,8 +1829,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "structopt-derive"
|
||||
version = "0.4.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
|
||||
source = "git+https://github.com/epilys/structopt-derive-manpage#2861b6318cfe9fce0a7edc61e202e522b036616c"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
|
|
|
@ -5,3 +5,6 @@ members = [
|
|||
"rest-http",
|
||||
"archive-http",
|
||||
]
|
||||
|
||||
[patch.crates-io]
|
||||
structopt-derive = { git = "https://github.com/epilys/structopt-derive-manpage" }
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* This file is part of mailpot
|
||||
*
|
||||
* Copyright 2020 - Manos Pitsidianakis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use std::io::Write;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=../docs/command.mdoc");
|
||||
println!("cargo:rerun-if-changed=../docs/list.mdoc");
|
||||
println!("cargo:rerun-if-changed=../docs/error_queue.mdoc");
|
||||
println!("cargo:rerun-if-changed=../docs/main.mdoc");
|
||||
println!("cargo:rerun-if-changed=../docs/header.mdoc");
|
||||
println!("cargo:rerun-if-changed=../docs/footer.mdoc");
|
||||
println!("cargo:rerun-if-changed=../docs/mailpot.1.m4");
|
||||
println!("cargo:rerun-if-changed=../docs/mailpot.1");
|
||||
println!("cargo:rerun-if-changed=../docs");
|
||||
println!("cargo:rerun-if-changed=./src/main.rs");
|
||||
println!("build running");
|
||||
std::env::set_current_dir("..").expect("could not chdir('..')");
|
||||
|
||||
let output = Command::new("m4")
|
||||
.arg("./docs/mailpot.1.m4")
|
||||
.output()
|
||||
.unwrap();
|
||||
let mut file = std::fs::File::create("./docs/mailpot.1").unwrap();
|
||||
file.write_all(&output.stdout).unwrap();
|
||||
}
|
|
@ -35,7 +35,10 @@ use structopt::StructOpt;
|
|||
#[structopt(
|
||||
name = "mailpot",
|
||||
about = "mini mailing list manager",
|
||||
author = "Manos Pitsidianakis <epilys@nessuent.xyz>"
|
||||
author = "Manos Pitsidianakis <epilys@nessuent.xyz>",
|
||||
manpage = "docs/main.mdoc",
|
||||
manpage_header = "docs/header.mdoc",
|
||||
manpage_footer = "docs/footer.mdoc"
|
||||
)]
|
||||
struct Opt {
|
||||
/// Activate debug mode
|
||||
|
@ -60,6 +63,7 @@ struct Opt {
|
|||
}
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[structopt(manpage = "docs/command.mdoc")]
|
||||
enum Command {
|
||||
///Prints database filesystem location
|
||||
DbLocation,
|
||||
|
@ -107,6 +111,7 @@ enum Command {
|
|||
}
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[structopt(manpage = "docs/error_queue.mdoc")]
|
||||
enum ErrorQueueCommand {
|
||||
/// List.
|
||||
List,
|
||||
|
@ -131,6 +136,7 @@ enum ErrorQueueCommand {
|
|||
}
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[structopt(manpage = "docs/list.mdoc")]
|
||||
enum ListCommand {
|
||||
/// List members of list.
|
||||
Members,
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
.Bl -tag -width Ds -compact -offset indent
|
||||
.It Ic db-location
|
||||
Prints database filesystem location.
|
||||
.It Ic config-location
|
||||
Prints default configuration file filesystem location.
|
||||
.It Ic dump-database
|
||||
Dumps database data to STDOUT.
|
||||
.It Ic list-lists
|
||||
Lists all registered mailing lists.
|
||||
.It Ic list
|
||||
Mailing list management.
|
||||
.It Ic create-list
|
||||
.Fl -name Ar name
|
||||
List name.
|
||||
|
||||
.Fl -id Ar id
|
||||
List ID.
|
||||
|
||||
.Fl -address Ar address
|
||||
List e-mail address.
|
||||
|
||||
.Fl -description Ar description
|
||||
List description.
|
||||
|
||||
.Fl -archive-url Ar archive-url
|
||||
List archive URL.
|
||||
|
||||
Create new list.
|
||||
.It Ic post
|
||||
.Fl -dry-run
|
||||
.
|
||||
|
||||
Post message from STDIN to list.
|
||||
.It Ic error-queue
|
||||
Mail that has not been handled properly end up in the error queue.
|
||||
.It Ic db-location
|
||||
Prints database filesystem location.
|
||||
.It Ic config-location
|
||||
Prints default configuration file filesystem location.
|
||||
.It Ic dump-database
|
||||
Dumps database data to STDOUT.
|
||||
.It Ic list-lists
|
||||
Lists all registered mailing lists.
|
||||
.It Ic list
|
||||
Mailing list management.
|
||||
.It Ic create-list
|
||||
Create new list.
|
||||
.It Ic post
|
||||
Post message from STDIN to list.
|
||||
.It Ic error-queue
|
||||
Mail that has not been handled properly end up in the error queue.
|
||||
.El
|
||||
.Pp
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
.Bl -tag -width Ds -compact -offset indent
|
||||
.It Ic list
|
||||
List.
|
||||
.It Ic print
|
||||
.Fl -index Ar index ...
|
||||
index of entry.
|
||||
|
||||
.Fl -json
|
||||
JSON format.
|
||||
|
||||
Print entry in RFC5322 or JSON format.
|
||||
.It Ic delete
|
||||
.Fl -index Ar index ...
|
||||
index of entry.
|
||||
|
||||
.Fl -quiet
|
||||
Do not print in stdout.
|
||||
|
||||
Delete entry and print it in stdout.
|
||||
.It Ic list
|
||||
List.
|
||||
.It Ic print
|
||||
Print entry in RFC5322 or JSON format.
|
||||
.It Ic delete
|
||||
Delete entry and print it in stdout.
|
||||
.El
|
||||
.Pp
|
|
@ -0,0 +1,2 @@
|
|||
.Sh AUTHORS
|
||||
Manos Pitsidianakis <epilys@nessuent.xyz>
|
|
@ -0,0 +1,6 @@
|
|||
.Dd $Mdocdate$
|
||||
.Dt MAILPOT 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm mailpot
|
||||
.Nd mini mailing list manager.
|
|
@ -0,0 +1,104 @@
|
|||
|
||||
.Bl -tag -width Ds -compact -offset indent
|
||||
.It Ic members
|
||||
List members of list.
|
||||
.It Ic add-member
|
||||
.Fl -address Ar address
|
||||
E-mail address.
|
||||
|
||||
.Fl -name Ar name
|
||||
Name.
|
||||
|
||||
.Fl -digest
|
||||
Send messages as digest?.
|
||||
|
||||
.Fl -hide-address
|
||||
Hide message from list when posting?.
|
||||
|
||||
.Fl -receive-confirmation Ar receive-confirmation
|
||||
Hide message from list when posting? Receive confirmation email when posting?.
|
||||
|
||||
.Fl -receive-duplicates Ar receive-duplicates
|
||||
Receive posts from list even if address exists in To or Cc header?.
|
||||
|
||||
.Fl -receive-own-posts Ar receive-own-posts
|
||||
Receive own posts from list?.
|
||||
|
||||
.Fl -enabled Ar enabled
|
||||
Is subscription enabled?.
|
||||
|
||||
Add member to list.
|
||||
.It Ic remove-member
|
||||
.Fl -address Ar address
|
||||
E-mail address.
|
||||
|
||||
Remove member from list.
|
||||
.It Ic update-membership
|
||||
Update membership info.
|
||||
.It Ic add-policy
|
||||
.Fl -announce-only
|
||||
.
|
||||
|
||||
.Fl -subscriber-only
|
||||
.
|
||||
|
||||
.Fl -approval-needed
|
||||
.
|
||||
|
||||
Add policy to list.
|
||||
.It Ic remove-policy
|
||||
.Fl -pk Ar pk
|
||||
.
|
||||
|
||||
.
|
||||
.It Ic add-list-owner
|
||||
.Fl -address Ar address
|
||||
.
|
||||
|
||||
.Fl -name Ar name
|
||||
.
|
||||
|
||||
Add list owner to list.
|
||||
.It Ic remove-list-owner
|
||||
.Fl -pk Ar pk
|
||||
.
|
||||
|
||||
.
|
||||
.It Ic enable-membership
|
||||
Alias for update-membership --enabled true.
|
||||
.It Ic disable-membership
|
||||
Alias for update-membership --enabled false.
|
||||
.It Ic update
|
||||
Update mailing list details.
|
||||
.It Ic health
|
||||
Show mailing list health status.
|
||||
.It Ic info
|
||||
Show mailing list info.
|
||||
.It Ic members
|
||||
List members of list.
|
||||
.It Ic add-member
|
||||
Add member to list.
|
||||
.It Ic remove-member
|
||||
Remove member from list.
|
||||
.It Ic update-membership
|
||||
Update membership info.
|
||||
.It Ic add-policy
|
||||
Add policy to list.
|
||||
.It Ic remove-policy
|
||||
.
|
||||
.It Ic add-list-owner
|
||||
Add list owner to list.
|
||||
.It Ic remove-list-owner
|
||||
.
|
||||
.It Ic enable-membership
|
||||
Alias for update-membership --enabled true.
|
||||
.It Ic disable-membership
|
||||
Alias for update-membership --enabled false.
|
||||
.It Ic update
|
||||
Update mailing list details.
|
||||
.It Ic health
|
||||
Show mailing list health status.
|
||||
.It Ic info
|
||||
Show mailing list info.
|
||||
.El
|
||||
.Pp
|
|
@ -0,0 +1,224 @@
|
|||
.Dd $Mdocdate$
|
||||
.Dt MAILPOT 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm mailpot
|
||||
.Nd mini mailing list manager.
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl -debug
|
||||
.Op Fl -config Ar config
|
||||
.Op Fl -quiet | -q
|
||||
.Op Fl -verbose | -v
|
||||
.Op Fl -timestamp | -t Ar timestamp
|
||||
.Bl -tag -width flag -offset indent
|
||||
.It Fl -debug
|
||||
Activate debug mode.
|
||||
.It Fl -config Ar config
|
||||
Set config file.
|
||||
.It Fl -quiet | -q
|
||||
Silence all output.
|
||||
.It Fl -verbose | -v
|
||||
Verbose mode (-v, -vv, -vvv, etc).
|
||||
.It Fl -timestamp | -t Ar timestamp
|
||||
Timestamp (sec, ms, ns, none).
|
||||
.El
|
||||
|
||||
.Sh DESCRIPTION
|
||||
This command-line tool allows you to control databases of the mailing list manager
|
||||
.Nm Ns .
|
||||
.Pp
|
||||
.Sh COMMANDS
|
||||
|
||||
.Bl -tag -width Ds -compact -offset indent
|
||||
.It Ic db-location
|
||||
Prints database filesystem location.
|
||||
.It Ic config-location
|
||||
Prints default configuration file filesystem location.
|
||||
.It Ic dump-database
|
||||
Dumps database data to STDOUT.
|
||||
.It Ic list-lists
|
||||
Lists all registered mailing lists.
|
||||
.It Ic list
|
||||
Mailing list management.
|
||||
.It Ic create-list
|
||||
.Fl -name Ar name
|
||||
List name.
|
||||
|
||||
.Fl -id Ar id
|
||||
List ID.
|
||||
|
||||
.Fl -address Ar address
|
||||
List e-mail address.
|
||||
|
||||
.Fl -description Ar description
|
||||
List description.
|
||||
|
||||
.Fl -archive-url Ar archive-url
|
||||
List archive URL.
|
||||
|
||||
Create new list.
|
||||
.It Ic post
|
||||
.Fl -dry-run
|
||||
.
|
||||
|
||||
Post message from STDIN to list.
|
||||
.It Ic error-queue
|
||||
Mail that has not been handled properly end up in the error queue.
|
||||
.It Ic db-location
|
||||
Prints database filesystem location.
|
||||
.It Ic config-location
|
||||
Prints default configuration file filesystem location.
|
||||
.It Ic dump-database
|
||||
Dumps database data to STDOUT.
|
||||
.It Ic list-lists
|
||||
Lists all registered mailing lists.
|
||||
.It Ic list
|
||||
Mailing list management.
|
||||
.It Ic create-list
|
||||
Create new list.
|
||||
.It Ic post
|
||||
Post message from STDIN to list.
|
||||
.It Ic error-queue
|
||||
Mail that has not been handled properly end up in the error queue.
|
||||
.El
|
||||
.Pp
|
||||
|
||||
.Ss list subcommands
|
||||
|
||||
.Bl -tag -width Ds -compact -offset indent
|
||||
.It Ic members
|
||||
List members of list.
|
||||
.It Ic add-member
|
||||
.Fl -address Ar address
|
||||
E-mail address.
|
||||
|
||||
.Fl -name Ar name
|
||||
Name.
|
||||
|
||||
.Fl -digest
|
||||
Send messages as digest?.
|
||||
|
||||
.Fl -hide-address
|
||||
Hide message from list when posting?.
|
||||
|
||||
.Fl -receive-confirmation Ar receive-confirmation
|
||||
Hide message from list when posting? Receive confirmation email when posting?.
|
||||
|
||||
.Fl -receive-duplicates Ar receive-duplicates
|
||||
Receive posts from list even if address exists in To or Cc header?.
|
||||
|
||||
.Fl -receive-own-posts Ar receive-own-posts
|
||||
Receive own posts from list?.
|
||||
|
||||
.Fl -enabled Ar enabled
|
||||
Is subscription enabled?.
|
||||
|
||||
Add member to list.
|
||||
.It Ic remove-member
|
||||
.Fl -address Ar address
|
||||
E-mail address.
|
||||
|
||||
Remove member from list.
|
||||
.It Ic update-membership
|
||||
Update membership info.
|
||||
.It Ic add-policy
|
||||
.Fl -announce-only
|
||||
.
|
||||
|
||||
.Fl -subscriber-only
|
||||
.
|
||||
|
||||
.Fl -approval-needed
|
||||
.
|
||||
|
||||
Add policy to list.
|
||||
.It Ic remove-policy
|
||||
.Fl -pk Ar pk
|
||||
.
|
||||
|
||||
.
|
||||
.It Ic add-list-owner
|
||||
.Fl -address Ar address
|
||||
.
|
||||
|
||||
.Fl -name Ar name
|
||||
.
|
||||
|
||||
Add list owner to list.
|
||||
.It Ic remove-list-owner
|
||||
.Fl -pk Ar pk
|
||||
.
|
||||
|
||||
.
|
||||
.It Ic enable-membership
|
||||
Alias for update-membership --enabled true.
|
||||
.It Ic disable-membership
|
||||
Alias for update-membership --enabled false.
|
||||
.It Ic update
|
||||
Update mailing list details.
|
||||
.It Ic health
|
||||
Show mailing list health status.
|
||||
.It Ic info
|
||||
Show mailing list info.
|
||||
.It Ic members
|
||||
List members of list.
|
||||
.It Ic add-member
|
||||
Add member to list.
|
||||
.It Ic remove-member
|
||||
Remove member from list.
|
||||
.It Ic update-membership
|
||||
Update membership info.
|
||||
.It Ic add-policy
|
||||
Add policy to list.
|
||||
.It Ic remove-policy
|
||||
.
|
||||
.It Ic add-list-owner
|
||||
Add list owner to list.
|
||||
.It Ic remove-list-owner
|
||||
.
|
||||
.It Ic enable-membership
|
||||
Alias for update-membership --enabled true.
|
||||
.It Ic disable-membership
|
||||
Alias for update-membership --enabled false.
|
||||
.It Ic update
|
||||
Update mailing list details.
|
||||
.It Ic health
|
||||
Show mailing list health status.
|
||||
.It Ic info
|
||||
Show mailing list info.
|
||||
.El
|
||||
.Pp
|
||||
|
||||
.Ss error-queue subcommands
|
||||
|
||||
.Bl -tag -width Ds -compact -offset indent
|
||||
.It Ic list
|
||||
List.
|
||||
.It Ic print
|
||||
.Fl -index Ar index ...
|
||||
index of entry.
|
||||
|
||||
.Fl -json
|
||||
JSON format.
|
||||
|
||||
Print entry in RFC5322 or JSON format.
|
||||
.It Ic delete
|
||||
.Fl -index Ar index ...
|
||||
index of entry.
|
||||
|
||||
.Fl -quiet
|
||||
Do not print in stdout.
|
||||
|
||||
Delete entry and print it in stdout.
|
||||
.It Ic list
|
||||
List.
|
||||
.It Ic print
|
||||
Print entry in RFC5322 or JSON format.
|
||||
.It Ic delete
|
||||
Delete entry and print it in stdout.
|
||||
.El
|
||||
.Pp
|
||||
|
||||
.Sh AUTHORS
|
||||
Manos Pitsidianakis <epilys@nessuent.xyz>
|
|
@ -0,0 +1,14 @@
|
|||
include(`docs/header.mdoc')
|
||||
.Sh SYNOPSIS
|
||||
include(`docs/main.mdoc')
|
||||
.Sh DESCRIPTION
|
||||
This command-line tool allows you to control databases of the mailing list manager
|
||||
.Nm Ns .
|
||||
.Pp
|
||||
.Sh COMMANDS
|
||||
include(`docs/command.mdoc')
|
||||
.Ss list subcommands
|
||||
include(`docs/list.mdoc')
|
||||
.Ss error-queue subcommands
|
||||
include(`docs/error_queue.mdoc')
|
||||
include(`docs/footer.mdoc')
|
|
@ -0,0 +1,18 @@
|
|||
.Nm
|
||||
.Op Fl -debug
|
||||
.Op Fl -config Ar config
|
||||
.Op Fl -quiet | -q
|
||||
.Op Fl -verbose | -v
|
||||
.Op Fl -timestamp | -t Ar timestamp
|
||||
.Bl -tag -width flag -offset indent
|
||||
.It Fl -debug
|
||||
Activate debug mode.
|
||||
.It Fl -config Ar config
|
||||
Set config file.
|
||||
.It Fl -quiet | -q
|
||||
Silence all output.
|
||||
.It Fl -verbose | -v
|
||||
Verbose mode (-v, -vv, -vvv, etc).
|
||||
.It Fl -timestamp | -t Ar timestamp
|
||||
Timestamp (sec, ms, ns, none).
|
||||
.El
|
Loading…
Reference in New Issue