cli

package
v3.0.18 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cli

func Cli(args []string, config *CliConfig) (rc int, err error)

Cli parses the given arguments and then executes the appropriate subcommand.

We use this function instead of kong.Parse() so that we can pass in the arguments to parse. This allows us to more easily test the cli subcommands, and could later ease e.g. WASM usage.

XXX note how gitea/tea does this, also uses urfave instead of kong

func EditFile

func EditFile(fn string) (err error)

EditFile opens the chat file in the editor

Types

type CliConfig

type CliConfig struct {
	// Name is the name of the program
	Name string
	// Description is a short description of the program
	Description string
	// Version is the version of the program
	Version string
	// Exit is the function to call to exit the program
	Exit   func(int)
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

CliConfig contains the configuration for grokker's cli

func NewCliConfig

func NewCliConfig() *CliConfig

NewCliConfig returns a new Config struct with default values populated

Jump to

Keyboard shortcuts

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