Documentation
¶
Index ¶
- Variables
- func AddExportCommand(helpCmd *cobra.Command, hs *help.HelpSystem) error
- func MustRunUI(helpSystem *help.HelpSystem)
- func NewCobraHelpCommand(hs *help.HelpSystem) *cobra.Command
- func RunUI(helpSystem *help.HelpSystem) error
- func RunUIWithOutput(helpSystem *help.HelpSystem) (*model.Section, error)
- func SetHelpWriter(w io.Writer)
- func SetupCobraRootCommand(hs *help.HelpSystem, cmd *cobra.Command)
- func SetupCobraRootCommandE(hs *help.HelpSystem, cmd *cobra.Command) error
- type ExportCommand
- type ExportSettings
- type HelpFunc
- type UIFunc
- type UsageFunc
Constants ¶
This section is empty.
Variables ¶
var COBRA_COMMAND_HELP_TEMPLATE string
var COBRA_COMMAND_SHORT_HELP_TEMPLATE string
var COBRA_COMMAND_USAGE_TEMPLATE string
COBRA_COMMAND_USAGE_TEMPLATE - template used by the glazed library help cobra command. This template has been adapted from the cobra usage command template.
Original: https://github.com/spf13/cobra
Copyright 2013-2022 The Cobra Authors ¶
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
http://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.
2022-12-03 - Manuel Odendahl - Augmented template with sections 2022-12-04 - Manuel Odendahl - Significantly reworked to support markdown sections
Functions ¶
func AddExportCommand ¶ added in v1.2.4
func AddExportCommand(helpCmd *cobra.Command, hs *help.HelpSystem) error
AddExportCommand wires the export command into the help subcommand tree.
func MustRunUI ¶
func MustRunUI(helpSystem *help.HelpSystem)
MustRunUI runs the UI and exits on error
func NewCobraHelpCommand ¶
func NewCobraHelpCommand(hs *help.HelpSystem) *cobra.Command
NewCobraHelpCommand uses the InitDefaultHelpCommand code from cobra. This code is lifted from cobra and modified to accommodate help sections
Copyright 2013-2022 The Cobra Authors ¶
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
http://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.
2022-12-03 - Manuel Odendahl - Added support for help sections 2022-12-04 - Manuel Odendahl - Significantly reworked to support markdown sections 2025-07-10 - Manuel Odendahl - Added support for UI mode
func RunUIWithOutput ¶
func RunUIWithOutput(helpSystem *help.HelpSystem) (*model.Section, error)
RunUIWithOutput starts the interactive help UI and returns the selected section
func SetHelpWriter ¶ added in v0.7.1
SetHelpWriter configures the writer used for Glazed-generated Cobra help output. When unset, help content is written to the command's Stdout.
func SetupCobraRootCommand ¶
func SetupCobraRootCommand(hs *help.HelpSystem, cmd *cobra.Command)
func SetupCobraRootCommandE ¶ added in v1.2.5
func SetupCobraRootCommandE(hs *help.HelpSystem, cmd *cobra.Command) error
Types ¶
type ExportCommand ¶ added in v1.2.4
type ExportCommand struct {
*cmds.CommandDescription
// contains filtered or unexported fields
}
ExportCommand exports help sections as structured data or to disk.
func NewExportCommand ¶ added in v1.2.4
func NewExportCommand(hs *help.HelpSystem) (*ExportCommand, error)
NewExportCommand creates a new export command.
type ExportSettings ¶ added in v1.2.4
type ExportSettings struct {
Type string `glazed:"type"`
Topic string `glazed:"topic"`
Command string `glazed:"command"`
Flag string `glazed:"flag"`
Slug string `glazed:"slug"`
WithContent bool `glazed:"with-content"`
Format string `glazed:"format"`
OutputPath string `glazed:"output-path"`
FlattenDirs bool `glazed:"flatten-dirs"`
}
ExportSettings holds parsed flag values for the export command.
type UIFunc ¶
type UIFunc = func(hs *help.HelpSystem) error