-
Notifications
You must be signed in to change notification settings - Fork 155
Expand file tree
/
Copy pathinfo.go
More file actions
executable file
·53 lines (44 loc) · 1.45 KB
/
info.go
File metadata and controls
executable file
·53 lines (44 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
Copyright (C) 2021-2023, Kubefirst
This program is licensed under MIT.
See the LICENSE file for more details.
*/
package cmd
import (
"bytes"
"fmt"
"runtime"
"text/tabwriter"
"github.com/konstructio/kubefirst-api/pkg/configs"
"github.com/konstructio/kubefirst/internal/progress"
"github.com/konstructio/kubefirst/internal/teawrapper"
"github.com/spf13/cobra"
)
// infoCmd represents the info command
var infoCmd = &cobra.Command{
Use: "info",
Short: "provides general Kubefirst setup data",
Long: `Provides machine data, files and folders paths`,
RunE: teawrapper.WrapBubbleTea(func(_ *cobra.Command, _ []string) error {
config, err := configs.ReadConfig()
if err != nil {
return fmt.Errorf("failed to read config: %w", err)
}
var buf bytes.Buffer
tw := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', tabwriter.Debug)
fmt.Fprintln(&buf, "##")
fmt.Fprintln(&buf, "# Info summary")
fmt.Fprintln(&buf, "")
fmt.Fprintf(tw, "Name\tValue\n")
fmt.Fprintf(tw, "---\t---\n")
fmt.Fprintf(tw, "Operational System\t%s\n", config.LocalOs)
fmt.Fprintf(tw, "Architecture\t%s\n", config.LocalArchitecture)
fmt.Fprintf(tw, "Golang version\t%s\n", runtime.Version())
fmt.Fprintf(tw, "Kubefirst config file\t%s\n", config.KubefirstConfigFilePath)
fmt.Fprintf(tw, "Kubefirst config folder\t%s\n", config.K1FolderPath)
fmt.Fprintf(tw, "Kubefirst Version\t%s\n", configs.K1Version)
tw.Flush()
progress.Success(buf.String())
return nil
}),
}