args

package
v0.0.0-...-5d27ecb Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgOption

type ArgOption func(ArgOptions)

ArgOption captures a tweak that can be applied to the Arg.

func OptionFileSystem

func OptionFileSystem(fs FileSystem) ArgOption

OptionFileSystem allows the setting a filesystem option to configure the args.

type ArgOptions

type ArgOptions interface {
	SetFileSystem(FileSystem)
}

ArgOptions represents a way to set optional values to a installer option. The ArgOptions shows what options are available to change.

type Args

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

Args describes command line arguments

func New

func New(line string, options ...ArgOption) *Args

New creates a Args from the command line arguments.

func (*Args) AllCommands

func (a *Args) AllCommands() (c []string)

AllCommands returns all the commands.

func (*Args) CompletedCommands

func (a *Args) CompletedCommands() (c []string)

CompletedCommands returns all the potential completed commands

func (*Args) Directory

func (a *Args) Directory() string

Directory gives the directory of the current written last argument if it represents a file name being written. in case that it is not, we fall back to the current directory.

func (*Args) From

func (a *Args) From(i int) *Args

From captures a set of Args from a index.

func (*Args) Last

func (a *Args) Last() string

Last returns the last argument

func (*Args) LastCompleted

func (a *Args) LastCompleted() string

LastCompleted returns the last completed argument

type FileSystem

type FileSystem interface {

	// Stat returns a FileInfo describing the named file.
	Stat(string) (os.FileInfo, error)

	// Getwd returns a rooted path name corresponding to the current directory.
	Getwd() (string, error)
}

FileSystem is an abstraction over the native filesystem

Jump to

Keyboard shortcuts

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