cmd

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UpdateCheckFlag   bool
	UpdateVersionFlag string

	UpdateStarted   bool
	UpdateErrored   bool
	UpdateChecked   bool
	UpdateAvailable *ProgramVersion
	UpdateData      []interface{}
)
View Source
var BashCompletionCmd = &cobra.Command{
	Use:   "bash",
	Short: "Generate Bash completions",
	Long:  BashCompletionLong,
	Run: func(cmd *cobra.Command, args []string) {
		RootCmd.GenBashCompletion(os.Stdout)
	},
}
View Source
var BashCompletionLong = `` /* 214-byte string literal not displayed */
View Source
var CompletionCmd = &cobra.Command{
	Use:     "completion",
	Aliases: []string{"completions"},
	Short:   "Generate completion helpers for your terminal",
	Long:    "Generate completion helpers for your terminal",
}
View Source
var ConfigCmd = &cobra.Command{

	Use: "config",

	Short: "view and set, global and local config values",

	Long: configLong,

	PreRun: func(cmd *cobra.Command, args []string) {

		cs := strings.Fields(cmd.CommandPath())
		c := strings.Join(cs[1:], "/")
		ga.SendGaEvent(c, "<omit>", 0)

	},
}
View Source
var ExportCmd = &cobra.Command{

	Use: "export",

	Short: "export your data model to various formats",

	Long: exportLong,

	PreRun: func(cmd *cobra.Command, args []string) {

		cs := strings.Fields(cmd.CommandPath())
		c := strings.Join(cs[1:], "/")
		ga.SendGaEvent(c, "<omit>", 0)

	},

	Run: func(cmd *cobra.Command, args []string) {
		var err error

		err = ExportRun(args)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
	},
}
View Source
var FishCompletionCmd = &cobra.Command{
	Use:   "fish",
	Short: "Generate Fish completions",
	Long:  "Generate Fish completions",

	Run: func(cmd *cobra.Command, args []string) {
		RootCmd.GenZshCompletion(os.Stdout)
	},
}
View Source
var GenerateCmd = &cobra.Command{

	Use: "generate",

	Aliases: []string{
		"gen",
	},

	Short: "generate libraries and utilies for your data model",

	Long: generateLong,

	PreRun: func(cmd *cobra.Command, args []string) {

		cs := strings.Fields(cmd.CommandPath())
		c := strings.Join(cs[1:], "/")
		ga.SendGaEvent(c, "<omit>", 0)

	},

	Run: func(cmd *cobra.Command, args []string) {
		var err error

		err = GenerateRun(args)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
	},
}
View Source
var HackCmd = &cobra.Command{

	Use: "hack ...",

	Short: "development command",

	Long: hackLong,

	PreRun: func(cmd *cobra.Command, args []string) {

		cs := strings.Fields(cmd.CommandPath())
		c := strings.Join(cs[1:], "/")
		ga.SendGaEvent(c, "<omit>", 0)

	},

	Run: func(cmd *cobra.Command, args []string) {
		var err error

		err = HackRun(args)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
	},
}
View Source
var ImportCmd = &cobra.Command{

	Use: "import",

	Short: "import and create a data model from a multitude of sources",

	Long: importLong,

	PreRun: func(cmd *cobra.Command, args []string) {

		cs := strings.Fields(cmd.CommandPath())
		c := strings.Join(cs[1:], "/")
		ga.SendGaEvent(c, "<omit>", 0)

	},

	Run: func(cmd *cobra.Command, args []string) {
		var err error

		err = ImportRun(args)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
	},
}
View Source
var InitCmd = &cobra.Command{

	Use: "init",

	Short: "init the current directory for dma usage.",

	Long: initLong,

	PreRun: func(cmd *cobra.Command, args []string) {

		cs := strings.Fields(cmd.CommandPath())
		c := strings.Join(cs[1:], "/")
		ga.SendGaEvent(c, "<omit>", 0)

	},

	Run: func(cmd *cobra.Command, args []string) {
		var err error

		err = InitRun(args)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
	},
}
View Source
var ModelsetCmd = &cobra.Command{

	Use: "modelset",

	Aliases: []string{
		"model",
		"m",
	},

	Short: "create, view, migrate, and understand your data models.",

	Long: modelsetLong,

	PreRun: func(cmd *cobra.Command, args []string) {

		cs := strings.Fields(cmd.CommandPath())
		c := strings.Join(cs[1:], "/")
		ga.SendGaEvent(c, "<omit>", 0)

	},
}
View Source
var PowerShellCompletionCmd = &cobra.Command{
	Use:     "power-shell",
	Aliases: []string{"windows", "win", "power", "ps"},
	Short:   "Generate PowerShell completions",
	Long:    "Generate PowerShell completions",

	Run: func(cmd *cobra.Command, args []string) {
		RootCmd.GenPowerShellCompletion(os.Stdout)
	},
}
View Source
var RootCmd = &cobra.Command{

	Use: "dma",

	Short: "Your Data Model Assistant",

	Long: dmaLong,

	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		var err error

		err = RootPersistentPreRun(args)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
	},

	PreRun: func(cmd *cobra.Command, args []string) {

		ga.SendGaEvent("root", "<omit>", 0)

	},

	PersistentPostRun: func(cmd *cobra.Command, args []string) {
		var err error

		err = RootPersistentPostRun(args)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
	},
}
View Source
var StoreCmd = &cobra.Command{

	Use: "store",

	Aliases: []string{
		"s",
	},

	Short: "create, checkpoint, and migrate your storage engines",

	Long: storeLong,

	PreRun: func(cmd *cobra.Command, args []string) {

		cs := strings.Fields(cmd.CommandPath())
		c := strings.Join(cs[1:], "/")
		ga.SendGaEvent(c, "<omit>", 0)

	},
}
View Source
var UiCmd = &cobra.Command{

	Use: "ui",

	Short: "run dma's local web ui",

	Long: uiLong,

	PreRun: func(cmd *cobra.Command, args []string) {

		cs := strings.Fields(cmd.CommandPath())
		c := strings.Join(cs[1:], "/")
		ga.SendGaEvent(c, "<omit>", 0)

	},

	Run: func(cmd *cobra.Command, args []string) {
		var err error

		err = UiRun(args)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
	},
}
View Source
var UpdateCmd = &cobra.Command{

	Use: "update",

	Short: "update the dma tool",

	Long: UpdateLong,

	PreRun: func(cmd *cobra.Command, args []string) {
		ga.SendGaEvent("update", "<omit>", 0)

	},

	Run: func(cmd *cobra.Command, args []string) {

		latest, err := CheckUpdate(true)
		if err != nil {
			fmt.Println(err)
			os.Exit(-1)
		}

		cur := ProgramVersion{Version: "v" + verinfo.Version}
		if latest.Version == cur.Version || (UpdateVersionFlag == "" && cur.Version == "vLocal") {
			return
		} else {
			if UpdateCheckFlag {
				PrintUpdateAvailable()
				return
			}
		}

		err = InstallUpdate()
		if err != nil {
			fmt.Println(err)
			os.Exit(-1)
		}
	},
}
View Source
var UpdateLong = `Print the build version for dma`
View Source
var VersionCmd = &cobra.Command{

	Use: "version",

	Aliases: []string{
		"ver",
	},

	Short: "print the version",

	Long: VersionLong,

	Run: func(cmd *cobra.Command, args []string) {

		s, e := os.UserConfigDir()
		fmt.Printf("dma ConfigDir %q %v\n", filepath.Join(s, "dma"), e)

		fmt.Printf(
			versionMessage,
			verinfo.Version,
			verinfo.Commit,
			verinfo.BuildDate,
			verinfo.GoVersion,
			verinfo.BuildOS,
			verinfo.BuildArch,
		)
	},
}
View Source
var VersionLong = `Print the build version for dma`
View Source
var ZshCompletionCmd = &cobra.Command{
	Use:   "zsh",
	Short: "Generate Zsh completions",
	Long:  "Generate Zsh completions",
	Run: func(cmd *cobra.Command, args []string) {
		RootCmd.GenZshCompletion(os.Stdout)
	},
}

Functions

func ExportRun

func ExportRun(args []string) (err error)

func GenerateRun

func GenerateRun(args []string) (err error)

func HackRun added in v0.0.2

func HackRun(args []string) (err error)

func ImportRun

func ImportRun(args []string) (err error)

func InitRun

func InitRun(args []string) (err error)

func InstallUpdate added in v0.0.4

func InstallUpdate() (err error)

func PrintUpdateAvailable

func PrintUpdateAvailable()

func RootPersistentPostRun

func RootPersistentPostRun(args []string) (err error)

func RootPersistentPreRun

func RootPersistentPreRun(args []string) (err error)

func UiRun

func UiRun(args []string) (err error)

func WaitPrintUpdateAvailable added in v0.0.5

func WaitPrintUpdateAvailable()

Types

type ProgramVersion

type ProgramVersion struct {
	Version string
	URL     string
}

func CheckUpdate

func CheckUpdate(manual bool) (ver ProgramVersion, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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