airshipctl/docs/tools/generate_cli_docs.go
Drew Walters 0d7dc4de24 Add automated CLI documentation
This change creates a tool that generates CLI documentation each time
`make update-golden` is executed.

Change-Id: I4bcdf299cd424f4cff1ecf6503822d304e9a3947
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-05-13 19:43:10 +00:00

41 lines
977 B
Go

/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"fmt"
"os"
"github.com/spf13/cobra/doc"
"opendev.org/airship/airshipctl/cmd"
)
func main() {
rootCmd, _, err := cmd.NewAirshipCTLCommand(os.Stdout)
if err != nil {
fmt.Fprintln(os.Stdout, err)
os.Exit(1)
}
// Remote auto-generated notice
rootCmd.DisableAutoGenTag = true
if err := doc.GenMarkdownTree(rootCmd, "./docs/source/cli"); err != nil {
fmt.Fprintln(os.Stdout, err)
os.Exit(1)
}
}