cmd

package
v0.7.14 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 17 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var COBRA_COMMAND_HELP_TEMPLATE string
View Source
var COBRA_COMMAND_SHORT_HELP_TEMPLATE string
View Source
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

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 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

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 RunUI

func RunUI(helpSystem *help.HelpSystem) error

RunUI starts the interactive help UI

func RunUIWithOutput

func RunUIWithOutput(helpSystem *help.HelpSystem) (*help.Section, error)

RunUIWithOutput starts the interactive help UI and returns the selected section

func SetHelpWriter added in v0.7.1

func SetHelpWriter(w io.Writer)

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)

Types

type HelpFunc

type HelpFunc = func(c *cobra.Command, args []string)

type UIFunc

type UIFunc = func(hs *help.HelpSystem) error

type UsageFunc

type UsageFunc = func(c *cobra.Command) error

Jump to

Keyboard shortcuts

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