Merge pull request #4140 from thaJeztah/man_man_man
man: move ctr.1 and containerd-config to section 8
This commit is contained in:
commit
1512f0dc29
10
Makefile
10
Makefile
@ -88,7 +88,7 @@ endif
|
||||
|
||||
# Project binaries.
|
||||
COMMANDS=ctr containerd containerd-stress
|
||||
MANPAGES=ctr.1 containerd.8 containerd-config.1 containerd-config.toml.5
|
||||
MANPAGES=ctr.8 containerd.8 containerd-config.8 containerd-config.toml.5
|
||||
|
||||
ifdef BUILDTAGS
|
||||
GO_BUILDTAGS = ${BUILDTAGS}
|
||||
@ -214,15 +214,15 @@ mandir:
|
||||
@mkdir -p man
|
||||
|
||||
# Kept for backwards compatability
|
||||
genman: man/containerd.8 man/ctr.1
|
||||
genman: man/containerd.8 man/ctr.8
|
||||
|
||||
man/containerd.8: FORCE
|
||||
@echo "$(WHALE) $@"
|
||||
go run cmd/gen-manpages/main.go containerd man/
|
||||
go run cmd/gen-manpages/main.go $(@F) $(@D)
|
||||
|
||||
man/ctr.1: FORCE
|
||||
man/ctr.8: FORCE
|
||||
@echo "$(WHALE) $@"
|
||||
go run cmd/gen-manpages/main.go ctr man/
|
||||
go run cmd/gen-manpages/main.go $(@F) $(@D)
|
||||
|
||||
man/%: docs/man/%.md FORCE
|
||||
@echo "$(WHALE) $@"
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/containerd/cmd/containerd/command"
|
||||
"github.com/containerd/containerd/cmd/ctr/app"
|
||||
@ -41,22 +42,28 @@ func run() error {
|
||||
"containerd": command.App(),
|
||||
"ctr": app.New(),
|
||||
}
|
||||
name := flag.Arg(0)
|
||||
dir := flag.Arg(1)
|
||||
app, ok := apps[name]
|
||||
if !ok {
|
||||
return fmt.Errorf("Invalid application '%s'", name)
|
||||
|
||||
parts := strings.SplitN(flag.Arg(0), ".", 2)
|
||||
if len(parts) != 2 {
|
||||
return fmt.Errorf("invalid name '%s': name does not contain man page section", flag.Arg(0))
|
||||
}
|
||||
name, section := parts[0], parts[1]
|
||||
|
||||
appName, ok := apps[name]
|
||||
if !ok {
|
||||
return fmt.Errorf("invalid application '%s'", name)
|
||||
}
|
||||
|
||||
// clear out the usage as we use banners that do not display in man pages
|
||||
app.Usage = ""
|
||||
data, err := app.ToMan()
|
||||
appName.Usage = ""
|
||||
appName.ToMan()
|
||||
data, err := appName.ToMan()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
||||
os.Mkdir(dir, os.ModePerm)
|
||||
}
|
||||
if err := ioutil.WriteFile(filepath.Join(dir, fmt.Sprintf("%s.1", name)), []byte(data), 0644); err != nil {
|
||||
_ = os.MkdirAll(dir, os.ModePerm)
|
||||
if err := ioutil.WriteFile(filepath.Join(dir, fmt.Sprintf("%s.%s", name, section)), []byte(data), 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
@ -1,4 +1,4 @@
|
||||
# containerd-config 1 01/30/2018
|
||||
# containerd-config 8 01/30/2018
|
||||
|
||||
## NAME
|
||||
|
||||
@ -38,4 +38,4 @@ Phil Estes <estesp@gmail.com>
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
ctr(1), containerd(8), containerd-config.toml(5)
|
||||
ctr(8), containerd(8), containerd-config.toml(5)
|
@ -142,4 +142,4 @@ Phil Estes <estesp@gmail.com>
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
ctr(1), containerd-config(1), containerd(8)
|
||||
ctr(8), containerd-config(8), containerd(8)
|
||||
|
Loading…
Reference in New Issue
Block a user