-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
40 lines (34 loc) · 854 Bytes
/
main.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
package main
import (
"fmt"
"github.com/whyakari/nvim/pkg/arch"
"github.com/whyakari/nvim/pkg/termux"
"os/exec"
)
func main() {
if arch.IsArchLinux() {
cmds := arch.ArchCommands()
for _, cmd := range cmds {
fmt.Printf("Executing: %s\n", cmd)
out, err := exec.Command("bash", "-c", cmd).CombinedOutput()
if err != nil {
fmt.Printf("Error executing command '%s': %s\nOutput: %s\n", cmd, err, string(out))
return
}
fmt.Printf("Output: %s\n", string(out))
}
} else if termux.IsTermux() {
cmds := termux.TermuxCommands()
for _, cmd := range cmds {
err := exec.Command("bash", "-c", cmd).Run()
if err != nil {
fmt.Println("Error when executing the command:", cmd)
return
}
}
} else {
fmt.Println("Operating system not supported.")
return
}
fmt.Println("Setup completed successfully (:")
}