From e9f28edf735d97106f60b9521991088e20f07c3a Mon Sep 17 00:00:00 2001
From: jvoisin <julien.voisin@dustri.org>
Date: Tue, 24 Jul 2018 22:34:33 +0200
Subject: [PATCH] Add a man page and document how to keep it up to date

---
 CONTRIBUTING.md |  9 ++++---
 doc/mat.1       | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
 mat2            |  2 +-
 3 files changed, 73 insertions(+), 4 deletions(-)
 create mode 100644 doc/mat.1

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 69f7f6f..fbda04e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -24,6 +24,9 @@ Since MAT2 is written in Python3, please conform as much as possible to the
 1. Update the [changelog](https://0xacab.org/jvoisin/mat2/blob/master/CHANGELOG.md)
 2. Update the version in the [mat2](https://0xacab.org/jvoisin/mat2/blob/master/mat2) file
 3. Update the version in the [setup.py](https://0xacab.org/jvoisin/mat2/blob/master/setup.py) file
-4. Commit the changelog, mat2 and setup.py files
-5. Create a tag with `git tag -s $VERSION`
-6. Push the tag with `git push --tags`
+4. Update the version and date in the [man page](https://0xacab.org/jvoisin/mat2/blob/master/doc/mat.1)
+5. Commit the changelog, man page, mat2 and setup.py files
+6. Create a tag with `git tag -s $VERSION`
+7. Push the commit with `git push origin master`
+8. Push the tag with `git push --tags`
+9. Do the secret release dance
diff --git a/doc/mat.1 b/doc/mat.1
new file mode 100644
index 0000000..a69bf7c
--- /dev/null
+++ b/doc/mat.1
@@ -0,0 +1,66 @@
+.TH MAT2 "1" "July 2018" "MAT2 0.2.0" "User Commands"
+
+.SH NAME
+mat2 \- the metadata anonymisation toolkit 2
+
+.SH SYNOPSIS
+mat2 [\-h] [\-v] [\-l] [\-c] [\-s | \-L]\fR [files [files ...]]
+
+.SH DESCRIPTION
+.B mat2
+removes metadata from various fileformats. It supports a wide variety of file 
+formats, audio, office, images, …
+
+.SH OPTIONS
+.SS "positional arguments:"
+.TP
+\fBfiles\fR
+the files to process
+.SS "optional arguments:"
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+show this help message and exit
+.TP
+\fB\-v\fR, \fB\-\-version\fR
+show program's version number and exit
+.TP
+\fB\-l\fR, \fB\-\-list\fR
+list all supported fileformats
+.TP
+\fB\-c\fR, \fB\-\-check\-dependencies\fR
+check if MAT2 has all the dependencies it needs
+.TP
+\fB\-s\fR, \fB\-\-show\fR
+list harmful metadata detectable by MAT2 without
+removing them
+.TP
+\fB\-L\fR, \fB\-\-lightweight\fR
+remove SOME metadata
+
+.SH EXAMPLES
+To remove all the metadata from a PDF file:
+.PP
+.nf
+.RS
+mat2 ./myfile.pdf
+.RE
+.fi
+.PP
+
+.SH BUGS
+
+While mat2 does its very best to remove every single metadata,
+it's still in beta, and \fBsome\fR might remain. Should you encounter
+some issues, check the bugtracker: https://0xacab.org/jvoisin/mat2/issues
+.PP
+Please use accordingly and be careful.
+
+.SH AUTHOR
+This software was made by Julien (jvoisin) Voisin with the support of the Tails project.
+
+.SH COPYRIGHT
+This software is released on LGPLv3.
+
+.SH "SEE ALSO"
+.BR exiftool (1p)
+.BR pdf-redact-tools (1)
diff --git a/mat2 b/mat2
index 5942d84..d24f2bc 100755
--- a/mat2
+++ b/mat2
@@ -31,7 +31,7 @@ def __check_file(filename: str, mode: int=os.R_OK) -> bool:
 
 def create_arg_parser():
     parser = argparse.ArgumentParser(description='Metadata anonymisation toolkit 2')
-    parser.add_argument('files', nargs='*')
+    parser.add_argument('files', nargs='*', help='the files to process')
     parser.add_argument('-v', '--version', action='version',
                         version='MAT2 %s' % __version__)
     parser.add_argument('-l', '--list', action='store_true',
-- 
GitLab