gocli

package
v0.0.0-...-dad8208 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2015 License: BSD-2-Clause Imports: 6 Imported by: 1

README

#gocli GoDoc Package gocli implements common idioms for handling Go packages in command line programs.

Download:

go get github.com/jimmyfrasche/goutil/gocli

Package gocli implements common idioms for handling Go packages in command line programs.


Automatically generated by autoreadme on 2015.11.06

Documentation

Overview

Package gocli implements common idioms for handling Go packages in command line programs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstError

func FirstError(pkgs []goutil.Packages, errs []error) ([]goutil.Packages, error)

FirstError is meant to wrap Import, it returns pkgs unchanged. If there were errors, only the first is returned.

func Flatten

func Flatten(pss []goutil.Packages) (out goutil.Packages)

Flatten takes a slice of goutil.Packages and returns a single goutil.Packages containing only the unique packages from the slice.

func Import

func Import(notree bool, ctx *build.Context, args []string) (pkgs []goutil.Packages, errs []error)

Import is for importing command line arguments. It uses the following rules:

If args is len 0, try to import the current directory.
Otherwise, for each argument:
	If it ends with ..., use goutil.ImportTree (unless notree is true)
	Otherwise, use goutil.Import

Regardless, the ctx is passed as is to the various importers.

Import returns a list of any errors that resulted from attmepting to import. If you only care about the first error, wrap the call in FirstError.

func ImportOne

func ImportOne(notree bool, ctx *build.Context, args []string) (goutil.Packages, error)

ImportOne only allows one argument to be specified.

func TagsFlag

func TagsFlag(tags string) *[]string

TagsFlag defines a tags flag, matching the tags flag on the go tool. The returned value is the address of a []string variable that stores the value of that flag.

The tags flag behaves exactly like the -tag flag for the go tool.

The name of the flag is always tags. The usage string is set to one similar to the usage of the tags flag on the go tool.

func TagsFlagSet

func TagsFlagSet(f *flag.FlagSet, tags string) *[]string

TagsFlagSet defines a tags flag, matching the tags flag on the go tool. The returned value is the address of a []string variable that stores the value of that flag.

The tags flag behaves exactly like the -tag flag for the go tool.

The name of the flag is always tags. The usage string is set to one similar to the usage of the tags flag on the go tool.

func TagsFlagSetVar

func TagsFlagSetVar(f *flag.FlagSet, val *[]string, tags string)

TagsFlagSetVar defines a tags flag, matching the tags flag on the go tool.

The tags flag behaves exactly like the -tag flag for the go tool.

The name of the flag is always tags. The usage string is set to one similar to the usage of the tags flag on the go tool.

func TagsFlagVar

func TagsFlagVar(val *[]string, tags string)

TagsFlagVar defines a tags flag, matching the tags flag on the go tool.

The tags flag behaves exactly like the -tag flag for the go tool.

The name of the flag is always tags. The usage string is set to one similar to the usage of the tags flag on the go tool.

Types

This section is empty.

Jump to

Keyboard shortcuts

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