xflag

package
v0.1.366 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package xflag add an additional flag type Array for repeated string flags.

var f xflag.Array
flag.Var(&f, "r", "some repeatable flag")

flag.Parse()                // $ command -r a -r b -r c
for _, v := range f { ... } // []string{"a", "b", "c"}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array []string

ArrayFlags allows to store lists of flag values.

func (*Array) Set

func (f *Array) Set(value string) error

Set appends a value.

func (*Array) String

func (f *Array) String() string

String representation.

type Date added in v0.1.333

type Date struct {
	time.Time
}

Date can be used to parse command line args into dates.

func (*Date) Set added in v0.1.333

func (d *Date) Set(value string) error

Set parses a value into a date, relatively flexible due to araddon/dateparse, 2014-04-26 will work, but oct. 7, 1970, too.

func (*Date) String added in v0.1.333

func (d *Date) String() string

String returns a formatted date.

type UserPassword added in v0.1.333

type UserPassword struct {
	User     string
	Password string
}

UserPassword allows to pass in user:password in flags.

func (*UserPassword) Set added in v0.1.333

func (u *UserPassword) Set(value string) error

func (*UserPassword) String added in v0.1.333

func (u *UserPassword) String() string

Jump to

Keyboard shortcuts

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