Skip to content

Commit

Permalink
New 'manpage' sub-command to generate manpages (#232)
Browse files Browse the repository at this point in the history
* New manpage command to generate manpages

* go mod tidy
  • Loading branch information
folbricht authored Mar 4, 2023
1 parent 92cf760 commit cc583e7
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 142 deletions.
1 change: 1 addition & 0 deletions cmd/desync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func main() {
newVerifyCommand(ctx),
newVerifyIndexCommand(ctx),
newMtreeCommand(ctx),
newManpageCommand(ctx, rootCmd),
)

if err := rootCmd.Execute(); err != nil {
Expand Down
37 changes: 37 additions & 0 deletions cmd/desync/manpage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package main

import (
"context"

"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
)

type manpageOptions struct {
doc.GenManHeader
}

func newManpageCommand(ctx context.Context, root *cobra.Command) *cobra.Command {
var opt manpageOptions

cmd := &cobra.Command{
Use: "manpage <output-directory>",
Short: "Generate manpages for desync",
Example: ` desync manpage /tmp/man`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return runManpage(ctx, opt, root, args)
},
SilenceUsage: true,
}
flags := cmd.Flags()
flags.StringVar(&opt.Title, "title", "desync", "title")
flags.StringVar(&opt.Section, "section", "3", "section")
flags.StringVar(&opt.Source, "source", "", "source")
flags.StringVar(&opt.Manual, "manual", "", "manual")
return cmd
}

func runManpage(ctx context.Context, opt manpageOptions, root *cobra.Command, args []string) error {
return doc.GenManTree(root, &opt.GenManHeader, args[0])
}
44 changes: 40 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,30 +1,66 @@
module github.com/folbricht/desync

go 1.15
go 1.18

require (
cloud.google.com/go/storage v1.12.0
github.com/DataDog/zstd v1.4.5
github.com/boljen/go-bitmap v0.0.0-20151001105940-23cd2fb0ce7d
github.com/dchest/siphash v1.2.2
github.com/fatih/color v1.10.0 // indirect
github.com/folbricht/tempfile v0.0.1
github.com/go-ini/ini v1.62.0
github.com/hanwen/go-fuse/v2 v2.0.3
github.com/klauspost/compress v1.11.4
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/minio/minio-go/v6 v6.0.57
github.com/pkg/errors v0.9.1
github.com/pkg/sftp v1.12.0
github.com/pkg/xattr v0.4.3
github.com/sirupsen/logrus v1.7.0
github.com/spf13/cobra v1.1.1
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.6.1
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
golang.org/x/sys v0.1.0 // indirect
google.golang.org/api v0.36.0
gopkg.in/cheggaaa/pb.v1 v1.0.28
)

require (
cloud.google.com/go v0.72.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.10.0 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/json-iterator/go v1.1.9 // indirect
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/klauspost/cpuid v1.2.3 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/minio/md5-simd v1.1.0 // indirect
github.com/minio/sha256-simd v0.1.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
go.opencensus.io v0.22.5 // indirect
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/mod v0.3.0 // indirect
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102 // indirect
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 // indirect
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 // indirect
golang.org/x/text v0.3.4 // indirect
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e // indirect
google.golang.org/grpc v1.33.2 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit cc583e7

Please sign in to comment.