diff --git a/cmd/lk/app.go b/cmd/lk/app.go index e083836f..662e8fbd 100644 --- a/cmd/lk/app.go +++ b/cmd/lk/app.go @@ -86,19 +86,11 @@ var ( Required: true, }, &cli.StringFlag{ - // Use "http://cloud-api.livekit.run" in local dev Name: "server-url", Value: cloudAPIServerURL, Destination: &serverURL, Hidden: true, }, - &cli.StringFlag{ - // Use "https://cloud.livekit.run" in local dev - Name: "dashboard-url", - Value: cloudDashboardURL, - Destination: &dashboardURL, - Hidden: true, - }, }, }, { @@ -108,24 +100,20 @@ var ( Before: requireProject, Action: installTemplate, }, + { + Name: "env", + Usage: "Manage environment variables", + Before: requireProject, + Action: func(ctx context.Context, cmd *cli.Command) error { + return instantiateEnv(ctx, cmd, ".") + }, + }, { Name: "run", Usage: "Execute a task defined in " + bootstrap.TaskFile, ArgsUsage: "`DIR` location or the project directory (default: current directory)", Action: runTask, }, - { - Name: "test", - Action: func(ctx context.Context, c *cli.Command) error { - templates, err := bootstrap.FetchTemplates(ctx) - if err != nil { - return err - } - - fmt.Printf("Fetched templates: %+v\n", templates) - return nil - }, - }, }, }, } @@ -330,6 +318,7 @@ func cloneTemplate(_ context.Context, cmd *cli.Command, url, appName string) err } os.RemoveAll(path.Join(appName, ".git")) }). + Style(theme.Focused.Title). Run(); err != nil { return err } @@ -388,7 +377,7 @@ func doInstall(ctx context.Context, task bootstrap.KnownTask, rootPath string, v if err := spinner.New(). Title("Installing..."). Action(func() { cmdErr = install() }). - Type(spinner.Dots). + Style(theme.Focused.Title). Run(); err != nil { return err } @@ -406,6 +395,7 @@ func doInstall(ctx context.Context, task bootstrap.KnownTask, rootPath string, v } func runTask(ctx context.Context, cmd *cli.Command) error { + verbose := cmd.Bool("verbose") taskName := cmd.Args().First() if taskName == "" { return errors.New("task name is required") @@ -421,5 +411,17 @@ func runTask(ctx context.Context, cmd *cli.Command) error { if err != nil { return err } - return task() + if verbose { + return task() + } else { + var cmdErr error + if err := spinner.New(). + Title("Running task " + taskName + "..."). + Action(func() { cmdErr = task() }). + Style(theme.Focused.Title). + Run(); err != nil { + return err + } + return cmdErr + } } diff --git a/cmd/lk/cloud.go b/cmd/lk/cloud.go index 9e6d1ae5..5802bff0 100644 --- a/cmd/lk/cloud.go +++ b/cmd/lk/cloud.go @@ -90,14 +90,12 @@ var ( Value: 4, }, &cli.StringFlag{ - // Use "http://cloud-api.livekit.run" in local dev Name: "server-url", Value: cloudAPIServerURL, Destination: &serverURL, Hidden: true, }, &cli.StringFlag{ - // Use "https://cloud.livekit.run" in local dev Name: "dashboard-url", Value: cloudDashboardURL, Destination: &dashboardURL, @@ -303,6 +301,7 @@ func tryAuthIfNeeded(ctx context.Context, cmd *cli.Command) error { Action(func() { ak, pollErr = pollClaim(ctx, cmd) }). + Style(theme.Focused.Title). Run(); err != nil { return err } diff --git a/go.mod b/go.mod index 9d935d43..112b0dc2 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.22.2 require ( github.com/charmbracelet/huh v0.6.0 - github.com/charmbracelet/huh/spinner v0.0.0-20240906163306-a9285a0ef8a3 + github.com/charmbracelet/huh/spinner v0.0.0-20240912161303-b56e9290a68e github.com/charmbracelet/lipgloss v0.13.0 github.com/frostbyte73/core v0.0.12 github.com/go-logr/logr v1.4.2 @@ -45,7 +45,7 @@ require ( github.com/catppuccin/go v0.2.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/charmbracelet/bubbles v0.20.0 // indirect - github.com/charmbracelet/bubbletea v1.1.0 // indirect + github.com/charmbracelet/bubbletea v1.1.1 // indirect github.com/charmbracelet/x/ansi v0.2.3 // indirect github.com/charmbracelet/x/exp/strings v0.0.0-20240809174237-9ab0ca04ce0c // indirect github.com/charmbracelet/x/term v0.2.0 // indirect diff --git a/go.sum b/go.sum index 461119f4..8a96969e 100644 --- a/go.sum +++ b/go.sum @@ -38,12 +38,12 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE= github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU= -github.com/charmbracelet/bubbletea v1.1.0 h1:FjAl9eAL3HBCHenhz/ZPjkKdScmaS5SK69JAK2YJK9c= -github.com/charmbracelet/bubbletea v1.1.0/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4= +github.com/charmbracelet/bubbletea v1.1.1 h1:KJ2/DnmpfqFtDNVTvYZ6zpPFL9iRCRr0qqKOCvppbPY= +github.com/charmbracelet/bubbletea v1.1.1/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4= github.com/charmbracelet/huh v0.6.0 h1:mZM8VvZGuE0hoDXq6XLxRtgfWyTI3b2jZNKh0xWmax8= github.com/charmbracelet/huh v0.6.0/go.mod h1:GGNKeWCeNzKpEOh/OJD8WBwTQjV3prFAtQPpLv+AVwU= -github.com/charmbracelet/huh/spinner v0.0.0-20240906163306-a9285a0ef8a3 h1:fP1Lr+Q8rWGLCifueSnqW/2QFtZUswA3YsNOx9OesZ0= -github.com/charmbracelet/huh/spinner v0.0.0-20240906163306-a9285a0ef8a3/go.mod h1:/dHGy3eS2ikDSO71IhslBdBGvrknQ+ze/VDiNdIxocw= +github.com/charmbracelet/huh/spinner v0.0.0-20240912161303-b56e9290a68e h1:7j2L0HkIzFSdzDmP2Dl97Q8ttWzlwubIgiNrutMd5Lc= +github.com/charmbracelet/huh/spinner v0.0.0-20240912161303-b56e9290a68e/go.mod h1:Cxhgl8N0sX9A+EQxedzzGZAalaF8fUVL+JP/pSOW8cI= github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw= github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY= github.com/charmbracelet/x/ansi v0.2.3 h1:VfFN0NUpcjBRd4DnKfRaIRo53KRgey/nhOoEqosGDEY= diff --git a/pkg/bootstrap/bootstrap.go b/pkg/bootstrap/bootstrap.go index 9684bc16..f249a943 100644 --- a/pkg/bootstrap/bootstrap.go +++ b/pkg/bootstrap/bootstrap.go @@ -53,12 +53,13 @@ const ( ) type Template struct { - Name string `yaml:"name" json:"name"` - Desc string `yaml:"desc" json:"description,omitempty"` - URL string `yaml:"url" json:"url,omitempty"` - Docs string `yaml:"docs" json:"docs_url,omitempty"` - Image string `yaml:"image" json:"image_ref,omitempty"` - Tags []string `yaml:"tags" json:"tags,omitempty"` + Name string `yaml:"name" json:"name"` + Desc string `yaml:"desc" json:"description,omitempty"` + URL string `yaml:"url" json:"url,omitempty"` + Docs string `yaml:"docs" json:"docs_url,omitempty"` + Image string `yaml:"image" json:"image_ref,omitempty"` + Tags []string `yaml:"tags" json:"tags,omitempty"` + IsSandbox bool `yaml:"is_sandbox" json:"is_sandbox,omitempty"` } func FetchTemplates(ctx context.Context) ([]Template, error) { diff --git a/version.go b/version.go index d0945fab..f4472a54 100644 --- a/version.go +++ b/version.go @@ -15,5 +15,5 @@ package livekitcli const ( - Version = "2.1.0" + Version = "2.1.1" )