cmd

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2017 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	PreRun: func(cmd *cobra.Command, args []string) {
		if askVersion {
			fmt.Println(version)
			os.Exit(0)
		}

		if len(args) > 0 && args[0] == "help" {
			fmt.Println(usageDetail())
			os.Exit(1)
		}
	},
	Run: func(cmd *cobra.Command, args []string) {
		pa, err := parsePositionalArguments(args)
		if err != nil {
			fmt.Println(usageShort())
			fmt.Println(errorString(err))
			os.Exit(1)
		}
		if !isatty.IsTerminal(os.Stdin.Fd()) {
			if params, err = ioutil.ReadAll(os.Stdin); err != nil {
				exitWithError(err)
			}
		}
		httpMethod = pa.httpMethod
		requestItems = pa.requestItems
		uri = pa.uri
		dumpConfig := &DumpConfig{
			verbose:  verbose,
			onlyBody: onlyBody,
		}
		initConfig()

		c := NewClient(accessKeyID, accessKeySecret, time.Duration(timeout)*time.Second)
		resp, err := c.doRequest(
			httpMethod, uri, params, noAuth, dumpConfig,
		)
		if err != nil {
			exitWithError(err)
		}
		defer resp.Body.Close()
	},
}

Functions

func Execute

func Execute()

Types

type Client

type Client struct {
	http.Client
	// contains filtered or unexported fields
}

Client ...

func NewClient

func NewClient(accessKeyID, accessKeySecret string, timeout time.Duration) *Client

NewClient ...

type Config

type Config struct {
	Auths map[string]configAuth `json:"auths"`
}

Config ...

type DumpConfig

type DumpConfig struct {
	// contains filtered or unexported fields
}

DumpConfig config for dump http request and response

type Hook

type Hook interface {
	// contains filtered or unexported methods
}

Hook for request

type PositionalArgument

type PositionalArgument struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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