// This prints out the CLI reference
This prints out the CLI reference
// This prints out the CLI reference
func referencePrinter(command *cobra.Command, level int) string {
	var commandListTable [][]string
	for _, subcommand := range command.Commands() {
		name := fmt.Sprintf("[%s](#%s)", subcommand.Name(), subcommand.Name())
		commandListTable = append(commandListTable, []string{name, subcommand.Short})
	}
	tableOutput := new(bytes.Buffer)
	table := tablewriter.NewWriter(tableOutput)
	table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
	table.SetCenterSeparator("|")
	table.SetHeader([]string{"Name", "Description"})
	table.SetColWidth(10000)
	table.AppendBulk(commandListTable)
	table.Render() 
	var commandOutput string
	for _, subcommand := range command.Commands() {
		commandOutput = commandOutput + referenceCommandFormatter(subcommand)
	}
	return fmt.Sprintf(`# Overview of the Odo (OpenShift Do) CLI Structure
> Example application
%s 
%s
# Syntax
#### List of Commands
%s
#### CLI Structure
%s
%s
`,
		"```sh\n"+command.Example+"\n```",
		command.Long,
		tableOutput.String(),
		"```sh\n"+fmt.Sprint(commandPrinter(command, 0))+"\n```",
		commandOutput)
}
func referencePrinter ( command * cobra . Command , level int ) string { var commandListTable [ ] [ ] string for _ , subcommand := range command . Commands ( ) { name := fmt . Sprintf ( " " , subcommand . Name ( ) , subcommand . Name ( ) ) commandListTable = append ( commandListTable , [ ] string { name , subcommand . Short } ) } tableOutput := new ( bytes . Buffer ) table := tablewriter . NewWriter ( tableOutput ) table . SetBorders ( tablewriter . Border { Left : true , Top : false , Right : true , Bottom : false } ) table . SetCenterSeparator ( " " ) table . SetHeader ( [ ] string { " " , " " } ) table . SetColWidth ( 10000 ) table . AppendBulk ( commandListTable ) table . Render ( ) var commandOutput string for _ , subcommand := range command . Commands ( ) { commandOutput = commandOutput + referenceCommandFormatter ( subcommand ) } return fmt . Sprintf ( `# Overview of the Odo (OpenShift Do) CLI Structure

> Example application

%s 

%s

# Syntax

#### List of Commands

%s

#### CLI Structure

%s

%s
` , " \n " + command . Example + " \n " , command . Long , tableOutput . String ( ) , " \n " + fmt . Sprint ( commandPrinter ( command , 0 ) ) + " \n " , commandOutput ) }
This prints out the CLI reference
This prints out the CLI reference
// List each command // Create a "table" for listing each command // Send output to writer // Create documentation for each command // The main markdown "template" for everything