cmd

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2017 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CompletionCmd = &cobra.Command{
	Use:   "completion",
	Short: TR("completion.cli.summary"),
	Long:  TR("completion.cli.description"),
	RunE: func(cmd *cobra.Command, args []string) error {
		err := RootCmd.GenBashCompletion(os.Stdout)
		if err != nil {
			return err
		}
		return nil
	},
}

CompletionCmd defines 'completion' subcommand

View Source
var ConfigureCmd = &cobra.Command{
	Use:   "configure",
	Short: TR("configure.cli.summary"),
	Long:  TR("configure.cli.description"),
	RunE: func(cmd *cobra.Command, args []string) error {
		pn := getSpecifiedProfileName()
		if pn == "" {
			pn = "default"
		}

		profile, err := collectProfileInfo(pn)
		if err != nil {
			cmd.SilenceUsage = true
			return err
		}

		err = saveProfile(pn, profile)
		if err != nil {
			cmd.SilenceUsage = true
			return err
		}

		return nil
	},
}

ConfigureCmd defines 'configure' subcommand

View Source
var ConfigureGetCmd = &cobra.Command{
	Use:   "get",
	Short: TR("configure.get.cli.summary"),
	Long:  TR("configure.get.cli.description"),
	RunE: func(cmd *cobra.Command, args []string) error {
		pn := getSpecifiedProfileName()
		if pn == "" {
			pn = "default"
		}

		p, err := loadProfile(pn)
		if err != nil {
			return err
		}

		prettyPrintObjectAsJSON(p)
		return nil
	},
}

ConfigureGetCmd defineds 'get' subcommand

View Source
var UnconfigureCmd = &cobra.Command{
	Use:   "unconfigure",
	Short: TR("unconfigure.cli.summary"),
	Long:  TR("unconfigure.cli.description"),
	RunE: func(cmd *cobra.Command, args []string) error {
		pn := getSpecifiedProfileName()
		if pn == "" {
			pn = "default"
		}

		if confirmDeleteProfile(pn) {
			err := deleteProfile(pn)
			if err != nil {
				cmd.SilenceUsage = true
				return err
			}
		}

		return nil
	},
}

UnconfigureCmd defines 'unconfigure' subcommand

View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: TR("version.cli.summary"),
	Long:  TR("version.cli.description"),
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Printf("SORACOM API client v%s\n", version)
	},
}

VersionCmd defines 'version' subcommand

Functions

func TR

func TR(resourceID string) string

TR returns translated text specified by the resourceID

Types

This section is empty.

Jump to

Keyboard shortcuts

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