clidoc

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 6

README

Generate standard Solo.io documentation from Cobra CLIs

  • Takes the entry point to a Cobra CLI (the root *cobra.CMD) and produces files formatted for Solo's online documentation

Example usage

  • from Squash:
package main

import (
	"log"

	"github.com/solo-io/go-utils/clidoc"

	"github.com/solo-io/squash/pkg/squashctl"
	"github.com/solo-io/squash/pkg/version"
)

func main() {
	app, err := squashctl.App(version.Version)
	if err != nil {
		log.Fatal(err)
	}
	clidoc.MustGenerateCliDocs(app)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LatestConfig = Config{
	OutputDir: "./docs/content/cli",
}

this config represents the latest/best practices for doc generation. It may change outside semver-indicated breaking changes so only use it if you want to inherit updated practices and are not sensitive to changes in conventions

Functions

func GenerateCliDocs

func GenerateCliDocs(app *cobra.Command) error

deprecated, use GenerateCliDocsWithConfig

func GenerateCliDocsWithConfig added in v0.10.18

func GenerateCliDocsWithConfig(app *cobra.Command, config Config) error

GenerateCliDocs is the official way to convert Solo.io's command line tools to online documentation. It applies the file formatting and directory placement expected by Solo's documentation conventions.

func MustGenerateCliDocs

func MustGenerateCliDocs(app *cobra.Command)

MustGenerateCliDocs is the same as GenerateCliDocs but it exits with status 1 on error

Types

type Config added in v0.10.18

type Config struct {
	OutputDir string
}

Jump to

Keyboard shortcuts

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