/
profile-print.go
68 lines (59 loc) · 1.5 KB
/
profile-print.go
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package cmd
import (
"fmt"
"os"
"github.com/go-qamel/qamel/internal/config"
"github.com/spf13/cobra"
)
func profilePrintCmd() *cobra.Command {
return &cobra.Command{
Use: "print [profileName]",
Short: "Print data of specified profile",
Args: cobra.MaximumNArgs(1),
Run: profilePrintHandler,
}
}
func profilePrintHandler(cmd *cobra.Command, args []string) {
// Get profile name
profileName := "default"
if len(args) == 1 {
profileName = args[0]
}
// Load existing profiles
profiles, err := config.LoadProfiles(configPath)
if err != nil {
cRedBold.Println("Failed to print the profile:", err)
os.Exit(1)
}
// Save the profiles with removed item
profile, ok := profiles[profileName]
if !ok {
cRedBold.Printf("Failed to print the profile: %s not exists\n", profileName)
os.Exit(1)
}
cBlueBold.Printf("Details of profile %s\n", profileName)
cCyanBold.Print("OS : ")
fmt.Println(profile.OS)
cCyanBold.Print("Arch : ")
fmt.Println(profile.Arch)
cCyanBold.Print("Static : ")
fmt.Println(profile.Static)
cCyanBold.Print("Qmake : ")
fmt.Println(profile.Qmake)
cCyanBold.Print("Moc : ")
fmt.Println(profile.Moc)
cCyanBold.Print("Rcc : ")
fmt.Println(profile.Rcc)
cCyanBold.Print("Gcc : ")
fmt.Println(profile.Gcc)
cCyanBold.Print("G++ : ")
fmt.Println(profile.Gxx)
if profile.OS == "windows" {
if !profile.Static {
cCyanBold.Print("Objdump : ")
fmt.Println(profile.Objdump)
}
cCyanBold.Print("Windres : ")
fmt.Println(profile.Windres)
}
}