Skip to content

Commit

Permalink
remember device name
Browse files Browse the repository at this point in the history
  • Loading branch information
bcherry committed Jan 2, 2025
1 parent 4381265 commit 2f3228e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/lk/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,21 @@ func tryAuthIfNeeded(ctx context.Context, cmd *cli.Command) error {
return err
}

// name
var deviceName string
// get devicename
deviceName := cliConfig.DeviceName
if err := huh.NewInput().
Title("What is the name of this device?").
Value(&deviceName).
WithTheme(util.Theme).
Run(); err != nil {
return err
}

// remember device name for next time
cliConfig.DeviceName = deviceName
if err := cliConfig.PersistIfNeeded(); err != nil {
return err
}
fmt.Println("Device:", deviceName)

// request token
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
type CLIConfig struct {
DefaultProject string `yaml:"default_project"`
Projects []ProjectConfig `yaml:"projects"`
DeviceName string `yaml:"device_name"`
// absent from YAML
hasPersisted bool
}
Expand Down

0 comments on commit 2f3228e

Please sign in to comment.