mirror of https://github.com/databricks/cli.git
33 lines
787 B
Go
33 lines
787 B
Go
package fs
|
|
|
|
import (
|
|
"github.com/databricks/cli/cmd/root"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func newMkdirCommand() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "mkdir DIR_PATH",
|
|
// Alias `mkdirs` for this command exists for legacy purposes. This command
|
|
// is called databricks fs mkdirs in our legacy CLI: https://github.com/databricks/databricks-cli
|
|
Aliases: []string{"mkdirs"},
|
|
Short: "Make directories",
|
|
Long: `Mkdir will create directories along the path to the argument directory.`,
|
|
Args: cobra.ExactArgs(1),
|
|
PreRunE: root.MustWorkspaceClient,
|
|
}
|
|
|
|
cmd.RunE = func(cmd *cobra.Command, args []string) error {
|
|
ctx := cmd.Context()
|
|
|
|
f, path, err := filerForPath(ctx, args[0])
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return f.Mkdir(ctx, path)
|
|
}
|
|
|
|
return cmd
|
|
}
|