flagparser

package module
v0.0.0-...-0b7a32b Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flag

type Flag struct {
	Flags []string
	Type  string
}

Flag is a single flag, meant to be used in FlagParser

func Bool

func Bool(flags ...string) *Flag

Bool returns a bool parser

func Duration

func Duration(flags ...string) *Flag

Duration returns a duration parser

func Int

func Int(flags ...string) *Flag

Int returns an int parser

func String

func String(flags ...string) *Flag

String returns a string parser

type FlagParser

type FlagParser struct {
	Flags []*Flag
}

FlagParser parses the flags

func NewFlagParser

func NewFlagParser(flags ...*Flag) (parser *FlagParser, err error)

NewFlagParser returns a new FlagParser instance

func (*FlagParser) Parse

func (parser *FlagParser) Parse(in []string) (map[string]interface{}, error)

Parse parses the given slice of strings. Output is always given in the same order as NewFlagParser, followed by the remaining (non-captured) arguments as a slice of strings.

Jump to

Keyboard shortcuts

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