pcli

package module
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: MIT Imports: 16 Imported by: 40

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 CheckForUpdates added in v0.3.18

func CheckForUpdates() error

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

func Err added in v0.3.12

func Err() io.Writer

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

func FlagErrorFunc added in v0.1.0

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

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

func GetCiCommand added in v0.3.2

func GetCiCommand() *cobra.Command

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

func GlobalNormalizationFunc added in v0.1.0

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

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

func HelpFunc added in v0.1.0

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

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

func HelpTemplate added in v0.1.0

func HelpTemplate() string

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

func PcliOut added in v0.3.15

func PcliOut() io.Writer

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

func SetRepo added in v0.4.1

func SetRepo(repo string) error

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

func SetRootCmd added in v0.2.0

func SetRootCmd(cmd *cobra.Command)

SetRootCmd sets your rootCmd.

func Setup added in v0.3.12

func Setup()

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

func UsageFunc added in v0.1.0

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

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

func UsageTemplate added in v0.1.0

func UsageTemplate() string

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

func VersionTemplate added in v0.1.0

func VersionTemplate() string

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

Types

type MarkdownDocument added in v0.3.0

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

MarkdownDocument contains the command and it's markdown documentation.

func GenerateMarkdownDoc added in v0.3.5

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