pcli

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: MIT Imports: 16 Imported by: 1

README

PCLI ✨

PCLI is a custom Go module for pterm/cli-template, which handles all of its logic.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppInfo = meta{}
View Source
var DisableUpdateChecking = false

DisableUpdateChecking automatically checks if a new version of your application is pushed, and notifies the user.

View Source
var HelpSectionPrinter = pterm.DefaultSection.WithLevel(2).Sprint

HelpSectionPrinter is used to print the different sections in the CLIs help output. You can overwrite it with any Sprint function.

Functions

func CheckErr added in v0.4.8

func CheckErr(err error)

func CheckForUpdates

func CheckForUpdates() error

CheckForUpdates checks if a new version of your application is pushed, and notifies the user, if DisableUpdateChecking is true.

func CheckUpdateExit added in v0.4.8

func CheckUpdateExit()

func Err

func Err() io.Writer

Err is a drop in replacement for spf13/cobra `Err`

func FlagErrorFunc

func FlagErrorFunc() func(*cobra.Command, error) error

FlagErrorFunc is a drop in replacement for spf13/cobra `FlagErrorFunc`

func GetCiCommand

func GetCiCommand() *cobra.Command

GetCiCommand returns a custom crafted CI command. This must be used when using https://github.com/x0f5c3/cli-template.

func GlobalNormalizationFunc

func GlobalNormalizationFunc() func(f *pflag.FlagSet, name string) pflag.NormalizedName

GlobalNormalizationFunc is a drop in replacement for spf13/cobra `GlobalNormalizationFunc`

func HelpFunc

func HelpFunc() func(*cobra.Command, []string)

HelpFunc is a drop in replacement for spf13/cobra `HelpFunc`

func HelpTemplate

func HelpTemplate() string

HelpTemplate is a drop in replacement for spf13/cobra `HelpTemplate`

func PcliOut

func PcliOut() io.Writer

PcliOut is a drop in replacement for spf13/cobra `SetOut`

func SetRepo

func SetRepo(repo string) error

SetRepo must be set to your repository path (eg. x0f5c3/cli-template).

func SetRootCmd

func SetRootCmd(cmd *cobra.Command)

SetRootCmd sets your rootCmd.

func Setup

func Setup()

Setup replaces some cobra functions with pcli functions for nicer output.

func UsageFunc

func UsageFunc() func(*cobra.Command) error

UsageFunc is a drop in replacement for spf13/cobra `UsageFunc`

func UsageTemplate

func UsageTemplate() string

UsageTemplate is a drop in replacement for spf13/cobra `UsageTemplate`

func VersionTemplate

func VersionTemplate() string

VersionTemplate is a drop in replacement for spf13/cobra `VersionTemplate`

Types

type MarkdownDocument

type MarkdownDocument struct {
	Name     string
	Markdown string
	Command  *cobra.Command
	Filename string
}

MarkdownDocument contains the command and it's markdown documentation.

func GenerateMarkdownDoc

func GenerateMarkdownDoc(command *cobra.Command) (markdown MarkdownDocument)

GenerateMarkdownDoc walks trough every subcommand of rootCmd and creates a documentation written in Markdown for it.

Jump to

Keyboard shortcuts

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