cmd

package
v0.0.0-...-1c23e69 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Max int

Max results to return

View Source
var RootCmd = &cobra.Command{
	Use:   "go-spark",
	Short: "Displays the help",
	Long:  `Displays the go-spark help`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		tr := &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		}
		client := &http.Client{Transport: tr}
		SparkClient = ciscospark.NewClient(client)
		var token string
		viper.BindEnv("CISCO_SPARK_TOKEN")
		if viper.IsSet("CISCO_SPARK_TOKEN") {
			token = viper.GetString("CISCO_SPARK_TOKEN")
		} else if viper.IsSet("token") {
			token = viper.GetString("token")
		} else {
			fmt.Println(cmd.Help())
			os.Exit(-1)
		}
		SparkClient.Authorization = "Bearer " + token
	},
}

RootCmd represents the base command when called without any subcommands

View Source
var SparkClient *ciscospark.Client

SparkClient is Cisco Spark Client

Functions

func CheckTeamTitle

func CheckTeamTitle(team *ciscospark.Team) bool

CheckTeamTitle ...

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func PrintCSV

func PrintCSV(response interface{})

PrintCSV prints the response in CSV to stdout

func PrintJSON

func PrintJSON(response interface{})

PrintJSON prints the response to stdout

func PrintRequestWithBody

func PrintRequestWithBody(request *http.Request, body interface{})

PrintRequestWithBody prints the request with the Body

func PrintRequestWithoutBody

func PrintRequestWithoutBody(request *http.Request)

PrintRequestWithoutBody prints the request without the Body, mainly for GET requests

func PrintResponseFormat

func PrintResponseFormat(response interface{})

PrintResponseFormat prints the response depending on the format flag

Types

This section is empty.

Jump to

Keyboard shortcuts

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