2023-11-17 12:47:37 +00:00
|
|
|
package labs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/databricks/cli/cmd/labs/project"
|
2023-11-29 19:08:27 +00:00
|
|
|
"github.com/databricks/cli/libs/log"
|
2023-11-17 12:47:37 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func New(ctx context.Context) *cobra.Command {
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
Use: "labs",
|
|
|
|
Short: "Manage Databricks Labs installations",
|
|
|
|
Long: `Manage experimental Databricks Labs apps`,
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd.AddGroup(&cobra.Group{
|
|
|
|
ID: "labs",
|
|
|
|
Title: "Installed Databricks Labs",
|
|
|
|
})
|
|
|
|
|
|
|
|
cmd.AddCommand(
|
|
|
|
newListCommand(),
|
|
|
|
newInstallCommand(),
|
|
|
|
newUpgradeCommand(),
|
|
|
|
newInstalledCommand(),
|
|
|
|
newClearCacheCommand(),
|
|
|
|
newUninstallCommand(),
|
|
|
|
newShowCommand(),
|
|
|
|
)
|
|
|
|
all, err := project.Installed(ctx)
|
|
|
|
if err != nil {
|
2023-11-29 19:08:27 +00:00
|
|
|
log.Errorf(ctx, "Cannot retrieve installed labs: %s", err)
|
|
|
|
return cmd
|
2023-11-17 12:47:37 +00:00
|
|
|
}
|
|
|
|
for _, v := range all {
|
|
|
|
v.Register(cmd)
|
|
|
|
}
|
|
|
|
return cmd
|
|
|
|
}
|