util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package utils contains utility functions.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFlagTagNotFound           = errors.New("arg: given field doesn't have a `flag` tag")
	ErrStructFieldNotInitialized = errors.New("arg: given field is unitialized")
)

Functions

func GetArgumentFormOfStruct

func GetArgumentFormOfStruct(strt interface{}) (flags []string)

Uses reflection to transform a struct containing fields with `flag` tags to a string slice of POSIX compliant long form arguments.

func GetFlagFormOfStruct

func GetFlagFormOfStruct(strt interface{}) (flags []string)

func GetLongFlagFormOfField

func GetLongFlagFormOfField(fieldValue reflect.Value, fieldType reflect.StructField) (string, error)

Uses reflection to retrieve the `flag` tag of a field. The value of the `flag` field with the value of the field is used to construct a POSIX long flag argument string.

Types

This section is empty.

Directories

Path Synopsis
Package strutil provides different string utilities
Package strutil provides different string utilities

Jump to

Keyboard shortcuts

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