gen

package
v0.0.0-...-549c83c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ManPagesCmd = &cobra.Command{
	Use:   "man",
	Short: "Generate man pages for the Pharos api service",
	Long: `This command automatically generates up-to-date man pages of the
	Blinsight processor.  By default, it creates the man page files
	in the "man" directory under the current directory.`,

	RunE: func(cmd *cobra.Command, args []string) error {
		header := &doc.GenManHeader{
			Section: "1",
			Manual:  "Pharos API service Manual",
			Source:  fmt.Sprintf("pharos %s", meta.Version),
		}

		if !strings.HasSuffix(manDir, string(filepath.Separator)) {
			manDir += string(filepath.Separator)
		}

		if _, err := os.Stat(manDir); err != nil && os.IsNotExist(err) {
			fmt.Println("Directory", manDir, "does not exist, creating...")
			if err := os.MkdirAll(manDir, 0750); err != nil {
				return err
			}
		}

		cmd.Root().DisableAutoGenTag = true

		fmt.Println("Generating Pharos API service man pages in", manDir, "...")

		if err := doc.GenManTree(cmd.Root(), header, manDir); err != nil {
			return err
		}

		fmt.Println("Done.")

		return nil
	},
}
View Source
var RootCmd = &cobra.Command{
	Use:   "gen",
	Short: "Several useful generators",
	Long:  `Several useful generators`,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL