Skip to content

Commit

Permalink
chore(sbx): bump version (#428)
Browse files Browse the repository at this point in the history
* chore(sbx): propmpt for template before name

* chore(cmd): bump version
  • Loading branch information
rektdeckard authored Sep 24, 2024
1 parent f1db5f5 commit ee2e59a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
60 changes: 31 additions & 29 deletions cmd/lk/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,16 @@ func setupTemplate(ctx context.Context, cmd *cli.Command) error {
if err != nil {
return err
}
details, err := bootstrap.FetchSandboxDetails(ctx, sandboxID, token, serverURL)
if err != nil {
return err
}
if len(details.ChildTemplates) == 0 {
return errors.New("no child templates found for sandbox")
if templateURL == "" {
details, err := bootstrap.FetchSandboxDetails(ctx, sandboxID, token, serverURL)
if err != nil {
return err
}
if len(details.ChildTemplates) == 0 {
return errors.New("no child templates found for sandbox")
}
templateOptions = details.ChildTemplates
}
templateOptions = details.ChildTemplates
} else {
var err error
templateOptions, err = bootstrap.FetchTemplates(ctx)
Expand All @@ -189,28 +191,6 @@ func setupTemplate(ctx context.Context, cmd *cli.Command) error {
}
}

appName = cmd.Args().First()
if appName == "" {
appName = sandboxID
preinstallPrompts = append(preinstallPrompts, huh.NewInput().
Title("Application Name").
Placeholder("my-app").
Value(&appName).
Validate(func(s string) error {
if len(s) < 3 {
return errors.New("name is too short")
}
if !appNameRegex.MatchString(s) {
return errors.New("try a simpler name")
}
if s, _ := os.Stat(s); s != nil {
return errors.New("that name is in use")
}
return nil
}).
WithTheme(theme))
}

// if no template name or URL is specified, prompt user to choose from available templates
if templateName == "" && templateURL == "" {
templateSelect := huh.NewSelect[string]().
Expand All @@ -237,6 +217,28 @@ func setupTemplate(ctx context.Context, cmd *cli.Command) error {
}
}

appName = cmd.Args().First()
if appName == "" {
appName = sandboxID
preinstallPrompts = append(preinstallPrompts, huh.NewInput().
Title("Application Name").
Placeholder("my-app").
Value(&appName).
Validate(func(s string) error {
if len(s) < 3 {
return errors.New("name is too short")
}
if !appNameRegex.MatchString(s) {
return errors.New("try a simpler name")
}
if s, _ := os.Stat(s); s != nil {
return errors.New("that name is in use")
}
return nil
}).
WithTheme(theme))
}

if len(preinstallPrompts) > 0 {
group := huh.NewGroup(preinstallPrompts...)
if err := huh.NewForm(group).
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
package livekitcli

const (
Version = "2.1.4"
Version = "2.1.5"
)

0 comments on commit ee2e59a

Please sign in to comment.