Skip to content
This repository was archived by the owner on Jul 29, 2021. It is now read-only.

Commit 844d7c5

Browse files
committed
add template flag so the user could provide alternate template
1 parent b2a16b2 commit 844d7c5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var (
3737
// layout control
3838
tabWidth = flag.Int("tabwidth", 4, "tab width")
3939
showTimestamps = flag.Bool("timestamps", false, "show timestamps with directory listings")
40-
templateDir = flag.String("templates", "", "directory containing alternate template files")
40+
altPkgTemplate = flag.String("template", "", "alternate template")
4141
showPlayground = flag.Bool("play", false, "enable playground in web interface")
4242
showExamples = flag.Bool("ex", false, "show examples in command line mode")
4343
declLinks = flag.Bool("links", true, "link identifiers to their declarations")
@@ -122,7 +122,11 @@ func main() {
122122
pres.SrcMode = false
123123
pres.HTMLMode = false
124124

125-
readTemplates(pres, false)
125+
if *altPkgTemplate != "" {
126+
pres.PackageText = readTemplate("package.txt", *altPkgTemplate)
127+
} else {
128+
pres.PackageText = readTemplate("package.txt", pkgTemplate)
129+
}
126130

127131
if err := godoc.CommandLine(os.Stdout, fs, pres, flag.Args()); err != nil {
128132
log.Print(err)

0 commit comments

Comments
 (0)