MCPcopy
hub / github.com/spicetify/cli / init

Function init

spicetify.go:39–142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37)
38
39func init() {
40 if runtime.GOOS != "windows" &&
41 runtime.GOOS != "darwin" &&
42 runtime.GOOS != "linux" {
43 utils.PrintError("Unsupported OS.")
44 os.Exit(1)
45 }
46 if version == "" {
47 version = "Dev"
48 }
49
50 log.SetFlags(0)
51 // Supports print color output for Windows
52 log.SetOutput(colorable.NewColorableStdout())
53
54 // Separates flags and commands
55 for _, v := range os.Args[1:] {
56 if len(v) > 0 && v[0] == '-' {
57 if len(v) > 2 && v[1] != '-' {
58 for _, char := range v[1:] {
59 flags = append(flags, "-"+string(char))
60 }
61 } else {
62 flags = append(flags, v)
63 }
64 } else {
65 commands = append(commands, v)
66 }
67 }
68
69 for _, v := range flags {
70 switch v {
71 case "--bypass-admin":
72 bypassAdminCheck = true
73 case "-c", "--config":
74 log.Println(cmd.GetConfigPath())
75 os.Exit(0)
76 case "-h", "--help":
77 kind := ""
78 if len(commands) > 0 {
79 kind = commands[0]
80 }
81 if kind == "config" {
82 helpConfig()
83 } else {
84 help()
85 }
86
87 os.Exit(0)
88 case "-v", "--version":
89 log.Println(version)
90 os.Exit(0)
91 case "-e", "--extension":
92 extensionFocus = true
93 liveRefresh = true
94 case "-a", "--app":
95 appFocus = true
96 liveRefresh = true

Callers

nothing calls this directly

Calls 10

PrintErrorFunction · 0.92
GetConfigPathFunction · 0.92
CheckFunction · 0.92
PrintInfoFunction · 0.92
MigrateConfigFolderFunction · 0.92
MigrateFoldersFunction · 0.92
InitConfigFunction · 0.92
CheckUpdateFunction · 0.92
helpConfigFunction · 0.85
helpFunction · 0.85

Tested by

no test coverage detected