hello

package
v0.0.0-...-277eb20 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package hello provides "hello command" logic and associated types. By convention, the construction function for the primary type (also named "hello") is simply named "New". For other construction functions, the name of the type is used as a suffix. For instance, "hello.NewInfo()" for the type "hello.Info". Similarly, "Info" would be used as a prefix or suffix for the info-related types like "InfoRunParams". Each "group of types" is usually expressed in its own file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hello

type Hello struct {
	// contains filtered or unexported fields
}

Hello defines the app-level dependencies that are accessible within the Run function.

func New

func New(p primeable) *Hello

New contains the scope in which an instance of Hello is constructed from an implementation of primeable.

func (*Hello) Run

func (h *Hello) Run(params *Params) (rerr error)

Run contains the scope in which the hello runner logic is executed.

type Params

type Params struct {
	Name  string
	Echo  Text
	Extra bool
}

Params defines the parameters needed to execute a given runner. These values are typically collected from flags and arguments entered into the cli, but there is no reason that they couldn't be set in another manner.

func NewParams

func NewParams() *Params

NewParams contains a scope in which default or construction-time values can be set. If no default or construction-time values are necessary, direct construction of Params is fine, and this construction func may be dropped.

type Text

type Text struct {
	Value string
	// contains filtered or unexported fields
}

Text represents an implementation of captain.FlagMarshaler. It is a trivial example, and does not do very much interesting except provide a way to check if it has been set by the user.

func (*Text) IsSet

func (ns *Text) IsSet() bool

func (*Text) Set

func (t *Text) Set(v string) error

Set implements the captain flagmarshaler interface.

func (*Text) String

func (t *Text) String() string

String implements the fmt.Stringer and flagmarshaler interfaces.

func (*Text) Type

func (t *Text) Type() string

Type implements the flagmarshaler interface.

Jump to

Keyboard shortcuts

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