cobrabattlegrip

package module
v0.0.0-...-30679bc Latest Latest
Warning

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

Go to latest
Published: May 23, 2021 License: MIT Imports: 16 Imported by: 0

README

Welcome to cobrabattlegrip 👋

Version Prerequisite

CLI command that makes magic of your Cobra CLI.

🏠 Homepage

Demo

Prerequisites

  • npm >=5.5.0
  • node >=9.3.0

Install

go get github.com/ryanande/cobrabattlegrip

Usage

s

Author

👤 Ryan Anderson

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2021 Ryan Anderson.

This project is MIT licensed.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewJsonDocs

func NewJsonDocs(rootCmd *cobra.Command) *cobra.Command

NewDocs generates the CLI documentation in markdown

func Serve

func Serve(rootCmd *cobra.Command) error

func WebLogger

func WebLogger(rw http.ResponseWriter, req *http.Request, next http.HandlerFunc)

Types

type ApplicationDetails

type ApplicationDetails struct {
	AssemblyName string
	Commands     []CommandDetail
}

type CommandDetail

type CommandDetail struct {
	Name             string             `json:"name"`
	ShortDescription string             `json:"short"`
	LongDescription  string             `json:"long"`
	Examples         string             `json:"examples"`
	Options          OptionDescriptions `json:"options"`
}

CommandDetail structure contains parent level commands meta data

func GetCommandDetails

func GetCommandDetails(cmd *cobra.Command) ([]CommandDetail, error)

ConvertToJSON converts all the commandline options of the given command to JSON.

type OptionDescription

type OptionDescription struct {
	Name        string      `json:"name"`
	Default     interface{} `json:"default"`
	Description string      `json:"description"`
	Hidden      bool        `json:"hidden"`
	Section     string      `json:"section"`
	Type        string      `json:"type"`
	Values      string      `json:"values,omitempty"`
}

OptionDescription contains a properties that describe a commandline option.

type OptionDescriptions

type OptionDescriptions []OptionDescription

OptionDescriptions contains the descriptions for all commandline options of a command.

Jump to

Keyboard shortcuts

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