Skip to content

Commit

Permalink
chore: apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
abiosoft authored Nov 23, 2024
1 parent 0491f8f commit fbc6f93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
10 changes: 5 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func (c colimaApp) SSH(args ...string) error {
return guest.SSH(workDir, args...)
}

type status struct {
type statusInfo struct {
DisplayName string `json:"display_name"`
Driver string `json:"driver"`
Arch string `json:"arch"`
Expand All @@ -317,22 +317,22 @@ func (c colimaApp) getStatus() (*status, error) {
return nil, err
}

var status status
var status statusInfo
status.DisplayName = config.CurrentProfile().DisplayName
status.Driver = "QEMU"
conf, _ := configmanager.LoadInstance()
if !conf.Empty() {
status.Driver = conf.DriverLabel()
}
status.Arch = fmt.Sprintf("%v", c.guest.Arch())
status.Arch = string(c.guest.Arch())
status.Runtime = currentRuntime
status.MountType = conf.MountType
ipAddress := limautil.IPAddress(config.CurrentProfile().ID)
if ipAddress != "127.0.0.1" {
status.IPAddress = ipAddress
}
if currentRuntime == docker.Name {
status.DockerSocket = fmt.Sprintf("unix://%s", docker.HostSocketFile())
status.DockerSocket = "unix://" + docker.HostSocketFile()
}
if k, err := c.Kubernetes(); err == nil && k.Running(ctx) {
status.Kubernetes = true
Expand Down Expand Up @@ -370,7 +370,7 @@ func (c colimaApp) Status(extended bool, jsonOutput bool) error {

// docker socket
if status.DockerSocket != "" {
log.Println("socket:", "unix://"+status.DockerSocket)
log.Println("socket:", status.DockerSocket)
}

// kubernetes
Expand Down
5 changes: 1 addition & 4 deletions cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ var statusCmd = &cobra.Command{
Long: `Show the status of Colima`,
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if statusCmdArgs.json {
return newApp().Status(statusCmdArgs.extended, true)
}
return newApp().Status(statusCmdArgs.extended, false)
return newApp().Status(statusCmdArgs.extended, statusCmdArgs.json)
},
}

Expand Down

0 comments on commit fbc6f93

Please sign in to comment.