Updates some error messaging and fixes installed so that global listing still works
This commit is contained in:
parent
e18d4cd30a
commit
313351a575
11
main.go
11
main.go
|
@ -45,7 +45,7 @@ func main() {
|
|||
checkGlobalEnv()
|
||||
global = true
|
||||
modules = arg[3:]
|
||||
globalTxt = operators.GlobalPath
|
||||
globalTxt = globalText
|
||||
}
|
||||
|
||||
switch arg[1] {
|
||||
|
@ -65,6 +65,10 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
case "installed":
|
||||
if len(arg) > 2 && (arg[2] == "-g" || arg[2] == "--global") {
|
||||
global = true
|
||||
globalTxt = globalText
|
||||
}
|
||||
err := operators.ShowInstalled(global, globalTxt)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
|
@ -82,8 +86,7 @@ func main() {
|
|||
fmt.Printf("installing %s%s\n", mod, globalTxt)
|
||||
err := operators.Install(mod, global)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
fmt.Println()
|
||||
fmt.Printf(" \033[2m└\033[0m \033[31mERROR:\033[0m %s\n\n", err.Error())
|
||||
continue
|
||||
}
|
||||
installs = append(installs, mod)
|
||||
|
@ -97,7 +100,6 @@ func main() {
|
|||
err := operators.Remove(mod, global)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
fmt.Println()
|
||||
continue
|
||||
}
|
||||
removes = append(removes, mod)
|
||||
|
@ -111,7 +113,6 @@ func main() {
|
|||
err := operators.Update(mod, global)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
fmt.Println()
|
||||
continue
|
||||
}
|
||||
updates = append(updates, mod)
|
||||
|
|
|
@ -91,6 +91,9 @@ func Install(pkg string, global bool) error {
|
|||
cmd := exec.Command("sh", "-c", fmt.Sprintf("mv %s %s", filepath.Join(stagingDir, "*"), modDir))
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
if global {
|
||||
return fmt.Errorf("Unable to write modules to final location. Do you have access?")
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue