summaryrefslogtreecommitdiff
path: root/cmds/cmds.go
diff options
context:
space:
mode:
authorbpc2003 <wpesfriendnva@gmail.com>2025-05-24 14:25:58 -0400
committerbpc2003 <wpesfriendnva@gmail.com>2025-05-24 14:25:58 -0400
commit165c5c078b41ad2ea2edbd325948ed5aa0602e06 (patch)
treefc69e2cf5080b443091ecb5134cf0a47dfe78fe1 /cmds/cmds.go
parent1a90e3410a9bdaf606a6124930a0913c07b44c87 (diff)
consolidate all environment variable commands into env.go
Diffstat (limited to 'cmds/cmds.go')
-rw-r--r--cmds/cmds.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/cmds/cmds.go b/cmds/cmds.go
index 6d4d895..0cfee5e 100644
--- a/cmds/cmds.go
+++ b/cmds/cmds.go
@@ -1,11 +1,11 @@
+// cmds: handles system commands
package cmds
-import (
- "errors"
- "os"
- "strings"
-)
+import "strings"
+// Eval: evaluates a provided string into a command
+// if it can't find the command or the arguments are incorrect
+// returns an error
func Eval(cmd string) error {
args := strings.Split(cmd, " ")
switch args[0] {
@@ -20,16 +20,15 @@ func Eval(cmd string) error {
}
break
case "unset":
- if len(args) == 1 || len(args) >= 3 {
- return errors.New("usage: unset {name}")
+ if err := unset(args); err != nil {
+ return err
}
- os.Unsetenv(args[1])
break
case "set":
if len(args) > 1 {
set(args)
} else {
- printenv()
+ printEnv()
}
break
case "exit":