aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-09-17 16:44:28 -0700
committerFuwn <[email protected]>2024-09-17 16:44:28 -0700
commit51d86c7be9756674252b39412ca3b9cb1227b406 (patch)
treee4879f36441c16954f0c134fc3685760f5404b5a
parent2d47b7db708357393d0ea618ce423b4be73857f8 (diff)
downloadrui-51d86c7be9756674252b39412ca3b9cb1227b406.tar.xz
rui-51d86c7be9756674252b39412ca3b9cb1227b406.zip
feat(rui): use lookup paths
-rw-r--r--rui.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/rui.go b/rui.go
index 6495408..6a2848f 100644
--- a/rui.go
+++ b/rui.go
@@ -89,7 +89,7 @@ func main() {
},
},
Action: func(c *cli.Context) error {
- _, err := exec.LookPath("nh")
+ nh, err := exec.LookPath("nh")
extraArgs := []string{}
if err := Notify("Queued home switch"); err != nil {
@@ -101,7 +101,7 @@ func main() {
}
if err == nil && !c.Bool("force-home-manager") {
- err = Command("nh", append([]string{"home", "switch", "--"},
+ err = Command(nh, append([]string{"home", "switch", "--"},
extraArgs...)...)
} else {
user := c.String("user")
@@ -166,20 +166,19 @@ func main() {
},
},
Action: func(c *cli.Context) error {
- _, err := exec.LookPath("nh")
+ nh, err := exec.LookPath("nh")
if err := Notify("Queued OS switch"); err != nil {
return err
}
if err == nil && !c.Bool("force-nixos-rebuild") {
- err = Command("nh", "os", "switch")
+ err = Command(nh, "os", "switch")
} else {
- _, err = exec.LookPath("doas")
escalator := "sudo"
- if err == nil {
- escalator = "doas"
+ if doas, err := exec.LookPath("doas"); err != nil {
+ escalator = doas
}
hostname := c.String("hostname")