mirror of https://github.com/databricks/cli.git
set template in annotation
This commit is contained in:
parent
0f1cb67c98
commit
49f7969363
|
@ -20,9 +20,16 @@ var importDirCmd = &cobra.Command{
|
||||||
.scala, .py, .sql, .r, .R, .ipynb are stripped of their extensions.
|
.scala, .py, .sql, .r, .R, .ipynb are stripped of their extensions.
|
||||||
`,
|
`,
|
||||||
|
|
||||||
Annotations: map[string]string{},
|
Annotations: map[string]string{
|
||||||
PreRunE: root.MustWorkspaceClient,
|
"template": cmdio.Heredoc(`
|
||||||
Args: cobra.ExactArgs(2),
|
{{if eq .Type "IMPORT_STARTED"}}Import started
|
||||||
|
{{else if eq .Type "UPLOAD_COMPLETE"}}Uploaded {{.SourcePath}} -> {{.TargetPath}}
|
||||||
|
{{else if eq .Type "IMPORT_COMPLETE"}}Import completed
|
||||||
|
{{end}}
|
||||||
|
`),
|
||||||
|
},
|
||||||
|
PreRunE: root.MustWorkspaceClient,
|
||||||
|
Args: cobra.ExactArgs(2),
|
||||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
sourcePath := args[0]
|
sourcePath := args[0]
|
||||||
|
@ -75,12 +82,6 @@ var importDirCmd = &cobra.Command{
|
||||||
var importDirOverwrite bool
|
var importDirOverwrite bool
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
importDirCmd.Annotations["template"] = cmdio.Heredoc(`
|
|
||||||
{{if eq .Type "IMPORT_STARTED"}}Import started
|
|
||||||
{{else if eq .Type "UPLOAD_COMPLETE"}}Uploaded {{.SourcePath}} -> {{.TargetPath}}
|
|
||||||
{{else if eq .Type "IMPORT_COMPLETE"}}Import completed
|
|
||||||
{{end}}
|
|
||||||
`)
|
|
||||||
importDirCmd.Flags().BoolVar(&importDirOverwrite, "overwrite", false, "Overwrite if file already exists in the workspace")
|
importDirCmd.Flags().BoolVar(&importDirOverwrite, "overwrite", false, "Overwrite if file already exists in the workspace")
|
||||||
Cmd.AddCommand(importDirCmd)
|
Cmd.AddCommand(importDirCmd)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue