argshifter

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 1 Imported by: 0

README

argshifter @ go-argparser

argshifter is a submodule of go-argparser.

Its job is to help an argument parser walk through the whole argument array.

You can also use an ArgShifter seperately in your own projects.

License: MIT (inherited)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgShifter

type ArgShifter interface {
	/*
		Get the type of the current argument
	*/
	GetArgumentType() ArgType

	/*
		Get the current argument but do not shift
	*/
	Peek() string

	/*
		Get the current argument and switch to the next one

		Returns: string - the argument before the shift, bool - is any argument available
	*/
	Shift() (string, bool)

	/*
		Reset the status of the argument shifter
	*/
	Reset()

	/*
		Get arguments
	*/
	GetArgs() []string
}

Argument shifter interface

func NewArgShifter

func NewArgShifter(args []string) ArgShifter

type ArgType

type ArgType int

Argument type enumeration

const (
	Invalid ArgType = iota - 1
	Root
	Command
	Data
	ShortOption
	LongOption
	OptionWithData
)

Jump to

Keyboard shortcuts

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