Documentation ¶
Index ¶
- Variables
- func CallTS(ts *runtime.Script, args []string) error
- func CountRun(globs []string) (err error)
- func DepthRun(globs []string) (err error)
- func DiffRun(orig string, next string) (err error)
- func FlowRun(globs []string) (err error)
- func InsertRun(code string, globs []string) (err error)
- func InstallUpdate() (err error)
- func MaskRun(code string, globs []string) (err error)
- func PatchRun(patch string, orig string) (err error)
- func PickRun(code string, globs []string) (err error)
- func PrintUpdateAvailable()
- func ReplaceRun(code string, globs []string) (err error)
- func RootInit()
- func RootPersistentPostRun(args []string) (err error)
- func RunErr() error
- func RunExit()
- func RunInt() int
- func TransformRun(code string, globs []string) (err error)
- func UpsertRun(code string, globs []string) (err error)
- func ValidateRun(schema string, globs []string) (err error)
- func WaitPrintUpdateAvailable()
- type ProgramVersion
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 = `` /* 222-byte string literal not displayed */
View Source
var CompletionCmd = &cobra.Command{ Use: "completion", Aliases: []string{"completions"}, Short: "Generate completion helpers for popular terminals", Long: "Generate completion helpers for popular terminals", }
View Source
var (
CompletionVanillaFlag bool
)
View Source
var CountCmd = &cobra.Command{ Use: "count [files...]", Short: "count nodes in file(s)", Long: countLong, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { var err error var globs []string if 0 < len(args) { globs = args[0:] } err = CountRun(globs) if err != nil { fmt.Println(err) os.Exit(1) } }, }
View Source
var DepthCmd = &cobra.Command{ Use: "depth [files...]", Short: "calculate the depth of file(s)", Long: depthLong, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { var err error var globs []string if 0 < len(args) { globs = args[0:] } err = DepthRun(globs) if err != nil { fmt.Println(err) os.Exit(1) } }, }
View Source
var DiffCmd = &cobra.Command{ Use: "diff <orig> <next>", Aliases: []string{ "D", }, Short: "calculate the diff from orig to next file(s)", Long: diffLong, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { var err error if 0 >= len(args) { fmt.Println("missing required argument: 'orig'") cmd.Usage() os.Exit(1) } var orig string if 0 < len(args) { orig = args[0] } if 1 >= len(args) { fmt.Println("missing required argument: 'next'") cmd.Usage() os.Exit(1) } var next string if 1 < len(args) { next = args[1] } err = DiffRun(orig, next) 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.GenFishCompletion(os.Stdout, true) }, }
View Source
var FlowCmd = &cobra.Command{ Use: "flow [cue files...]", Aliases: []string{ "f", }, Short: "run file(s) through the hof/flow DAG engine", Long: flowLong, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { var err error var globs []string if 0 < len(args) { globs = args[0:] } err = FlowRun(globs) if err != nil { fmt.Println(err) os.Exit(1) } }, }
View Source
var InsertCmd = &cobra.Command{ Use: "insert <code> [files...]", Aliases: []string{ "i", }, Short: "insert into file(s) with code (only if not present)", Long: insertLong, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { var err error if 0 >= len(args) { fmt.Println("missing required argument: 'code'") cmd.Usage() os.Exit(1) } var code string if 0 < len(args) { code = args[0] } var globs []string if 1 < len(args) { globs = args[1:] } err = InsertRun(code, globs) if err != nil { fmt.Println(err) os.Exit(1) } }, }
View Source
var MaskCmd = &cobra.Command{ Use: "mask <code> [files...]", Aliases: []string{ "m", }, Short: "mask from file(s) with code", Long: maskLong, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { var err error if 0 >= len(args) { fmt.Println("missing required argument: 'code'") cmd.Usage() os.Exit(1) } var code string if 0 < len(args) { code = args[0] } var globs []string if 1 < len(args) { globs = args[1:] } err = MaskRun(code, globs) if err != nil { fmt.Println(err) os.Exit(1) } }, }
View Source
var PatchCmd = &cobra.Command{ Use: "patch <patch> <orig>", Aliases: []string{ "P", }, Short: "apply pacth to orig file(s)", Long: patchLong, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { var err error if 0 >= len(args) { fmt.Println("missing required argument: 'patch'") cmd.Usage() os.Exit(1) } var patch string if 0 < len(args) { patch = args[0] } if 1 >= len(args) { fmt.Println("missing required argument: 'orig'") cmd.Usage() os.Exit(1) } var orig string if 1 < len(args) { orig = args[1] } err = PatchRun(patch, orig) if err != nil { fmt.Println(err) os.Exit(1) } }, }
View Source
var PickCmd = &cobra.Command{ Use: "pick <code> [files...]", Aliases: []string{ "p", }, Short: "pick from file(s) with code", Long: pickLong, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { var err error if 0 >= len(args) { fmt.Println("missing required argument: 'code'") cmd.Usage() os.Exit(1) } var code string if 0 < len(args) { code = args[0] } var globs []string if 1 < len(args) { globs = args[1:] } err = PickRun(code, globs) if err != nil { fmt.Println(err) os.Exit(1) } }, }
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 ReplaceCmd = &cobra.Command{ Use: "replace <code> [files...]", Aliases: []string{ "r", }, Short: "replace in file(s) with code (only if present)", Long: replaceLong, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { var err error if 0 >= len(args) { fmt.Println("missing required argument: 'code'") cmd.Usage() os.Exit(1) } var code string if 0 < len(args) { code = args[0] } var globs []string if 1 < len(args) { globs = args[1:] } err = ReplaceRun(code, globs) if err != nil { fmt.Println(err) os.Exit(1) } }, }
View Source
var RootCmd = &cobra.Command{ Use: "cuetils", Short: "CUE Utilites for bulk ETL, diff, query, and other operations on data and config", Long: cuetilsLong, PreRun: func(cmd *cobra.Command, args []string) { }, 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 TransformCmd = &cobra.Command{ Use: "transform <code> [files...]", Aliases: []string{ "t", }, Short: "transform file(s) with code", Long: transformLong, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { var err error if 0 >= len(args) { fmt.Println("missing required argument: 'code'") cmd.Usage() os.Exit(1) } var code string if 0 < len(args) { code = args[0] } var globs []string if 1 < len(args) { globs = args[1:] } err = TransformRun(code, globs) if err != nil { fmt.Println(err) os.Exit(1) } }, }
View Source
var UpdateCmd = &cobra.Command{ Use: "update", Short: "update the cuetils tool", Long: UpdateLong, PreRun: func(cmd *cobra.Command, args []string) { }, 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 cuetils`
View Source
var UpsertCmd = &cobra.Command{ Use: "upsert <code> [files...]", Aliases: []string{ "u", }, Short: "upsert file(s) with code (extend and replace)", Long: upsertLong, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { var err error if 0 >= len(args) { fmt.Println("missing required argument: 'code'") cmd.Usage() os.Exit(1) } var code string if 0 < len(args) { code = args[0] } var globs []string if 1 < len(args) { globs = args[1:] } err = UpsertRun(code, globs) if err != nil { fmt.Println(err) os.Exit(1) } }, }
View Source
var ValidateCmd = &cobra.Command{ Use: "validate <schema> [files...]", Aliases: []string{ "v", }, Short: "validate file(s) with schema", Long: validateLong, PreRun: func(cmd *cobra.Command, args []string) { }, Run: func(cmd *cobra.Command, args []string) { var err error if 0 >= len(args) { fmt.Println("missing required argument: 'schema'") cmd.Usage() os.Exit(1) } var schema string if 0 < len(args) { schema = args[0] } var globs []string if 1 < len(args) { globs = args[1:] } err = ValidateRun(schema, globs) if err != nil { fmt.Println(err) os.Exit(1) } }, }
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("cuetils ConfigDir %q %v\n", filepath.Join(s, "cuetils"), 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 cuetils`
Functions ¶
func InstallUpdate ¶
func InstallUpdate() (err error)
func PrintUpdateAvailable ¶
func PrintUpdateAvailable()
func ReplaceRun ¶ added in v0.1.1
func RootPersistentPostRun ¶
func TransformRun ¶ added in v0.1.2
func ValidateRun ¶ added in v0.1.2
func WaitPrintUpdateAvailable ¶
func WaitPrintUpdateAvailable()
Types ¶
type ProgramVersion ¶
func CheckUpdate ¶
func CheckUpdate(manual bool) (ver ProgramVersion, err error)
Click to show internal directories.
Click to hide internal directories.