annotate cmd/sievemgr/man.go @ 10:44c07eb8ef08

Add man subcommand to display the user manual Generate the manual from the documentation in godoc format.
author Guido Berhoerster <guido+sievemgr@berhoerster.name>
date Thu, 03 Dec 2020 13:52:28 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
1 // Copyright (C) 2020 Guido Berhoerster <guido+sievemgr@berhoerster.name>
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
2 //
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
3 // Permission is hereby granted, free of charge, to any person obtaining
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
4 // a copy of this software and associated documentation files (the
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
5 // "Software"), to deal in the Software without restriction, including
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
6 // without limitation the rights to use, copy, modify, merge, publish,
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
7 // distribute, sublicense, and/or sell copies of the Software, and to
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
8 // permit persons to whom the Software is furnished to do so, subject to
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
9 // the following conditions:
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
10 //
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
11 // The above copyright notice and this permission notice shall be included
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
12 // in all copies or substantial portions of the Software.
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
13 //
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
17 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
18 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
19 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
20 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
21
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
22 package main
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
23
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
24 import (
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
25 "fmt"
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
26 )
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
27
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
28 var cmdMan = &command{
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
29 UsageLine: "man [options]",
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
30 Run: runMan,
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
31 }
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
32
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
33 func runMan(cmd *command, args []string) error {
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
34 if len(args) != 0 {
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
35 return usageError("invalid number of arguments")
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
36 }
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
37
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
38 fmt.Println(docText)
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
39
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
40 return nil
44c07eb8ef08 Add man subcommand to display the user manual
Guido Berhoerster <guido+sievemgr@berhoerster.name>
parents:
diff changeset
41 }