-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate man page when built with 'mango' build-tag
When building with the 'mango' build-tag (go build -tags mango) enabled, we will simply generate and print a man-page on startup and immediately exit again.
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//go:build mango | ||
// +build mango | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/muesli/mango" | ||
"github.com/muesli/mango/mflag" | ||
"github.com/muesli/roff" | ||
) | ||
|
||
func init() { | ||
manPage := mango.NewManPage(1, "soft", "A self-hostable Git server for the command line"). | ||
WithLongDescription("Soft Serve is a self-hostable Git server for the command line."). | ||
WithSection("Copyright", "(C) 2021-2022 Charmbracelet, Inc.\n"+ | ||
"Released under MIT license.") | ||
|
||
flag.VisitAll(mflag.FlagVisitor(manPage)) | ||
fmt.Println(manPage.Build(roff.NewDocument())) | ||
os.Exit(0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters