man-page
This commit is contained in:
9
internal/cmdmanpage/BUILD
Normal file
9
internal/cmdmanpage/BUILD
Normal file
@@ -0,0 +1,9 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["cmdmanpage.go"],
|
||||
importpath = "github.com/motiejus/code/undocker/internal/cmdmanpage",
|
||||
visibility = ["//src/undocker:__subpackages__"],
|
||||
deps = ["@com_github_jessevdk_go_flags//:go_default_library"],
|
||||
)
|
||||
25
internal/cmdmanpage/cmdmanpage.go
Normal file
25
internal/cmdmanpage/cmdmanpage.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package cmdmanpage
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
goflags "github.com/jessevdk/go-flags"
|
||||
)
|
||||
|
||||
type Command struct {
|
||||
parser *goflags.Parser
|
||||
stdout io.Writer
|
||||
}
|
||||
|
||||
func NewCommand(parser *goflags.Parser) *Command {
|
||||
return &Command{
|
||||
parser: parser,
|
||||
stdout: os.Stdout,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Command) Execute(args []string) error {
|
||||
c.parser.WriteManPage(c.stdout)
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user