fin

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Paragraph = pterm.ParagraphPrinter{
		MaxWidth: 70,
	}
	// Info returns a PrefixPrinter, which can be used to print text with an "info" Prefix.
	Info = pterm.PrefixPrinter{
		MessageStyle: infoMessageStyle,
		Prefix:       infoPrefix,
	}
	// Info returns a PrefixPrinter, which can be used to print text with an "info" Prefix.
	Verbose = pterm.PrefixPrinter{
		MessageStyle: verboseMessageStyle,
		Prefix:       verbosePrefix,
	}

	// Warning returns a PrefixPrinter, which can be used to print text with a "warning" Prefix.
	Warning = pterm.PrefixPrinter{
		MessageStyle: warningMessageStyle,
		Prefix:       warningPrefix,
	}

	// Success returns a PrefixPrinter, which can be used to print text with a "success" Prefix.
	Success = pterm.PrefixPrinter{
		MessageStyle: successMessageStyle,
		Prefix:       successPrefix,
	}

	// Error returns a PrefixPrinter, which can be used to print text with an "error" Prefix.
	Error = pterm.PrefixPrinter{
		MessageStyle: errorMessageStyle,
		Prefix:       errorPrefix,
	}

	// Fatal returns a PrefixPrinter, which can be used to print text with an "fatal" Prefix.
	// NOTICE: Fatal terminates the application immediately!
	Fatal = pterm.PrefixPrinter{
		MessageStyle: fatalMessageStyle,
		Prefix:       fatalPrefix,
		Fatal:        true,
	}

	// Debug Prints debug messages. By default it will only print if PrintDebugMessages is true.
	// You can change PrintDebugMessages with EnableDebugMessages and DisableDebugMessages, or by setting the variable itself.
	Debug = pterm.PrefixPrinter{
		MessageStyle: debugMessageStyle,
		Prefix:       debugPrefix,
		Debugger:     true,
	}

	// Description returns a PrefixPrinter, which can be used to print text with a "description" Prefix.
	Description = pterm.PrefixPrinter{
		MessageStyle: descriptionMessageStyle,
		Prefix:       descriptionPrefix,
	}
)
View Source
var AppInfo = meta{}
View Source
var DescriptionSectionPrinter = pterm.DefaultSection.WithLevel(2).Sprint
View Source
var DetailSectionPrinter = pterm.DefaultSection.WithLevel(3).Sprint
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.

View Source
var ParagraphPrinter = pterm.DefaultParagraph.Sprint
View Source
var TitleSectionPrinter = pterm.DefaultSection.WithLevel(1).Sprint

Functions

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

func Progress() *pterm.ProgressbarPrinter

func SetRepo

func SetRepo(repo string) error

SetRepo must be set to your repository path (eg. pterm/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 Spinner

func Spinner() *pterm.SpinnerPrinter

func Table

func Table() *pterm.TablePrinter

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