summaryrefslogtreecommitdiff
path: root/cmds/cmds.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/cmds.go')
-rw-r--r--cmds/cmds.go37
1 files changed, 14 insertions, 23 deletions
diff --git a/cmds/cmds.go b/cmds/cmds.go
index f61f2b8..6d4d895 100644
--- a/cmds/cmds.go
+++ b/cmds/cmds.go
@@ -20,34 +20,25 @@ func Eval(cmd string) error {
}
break
case "unset":
- if len(args) == 1 || len(args) >= 3{
- return errors.New("unset: usage: name")
+ if len(args) == 1 || len(args) >= 3 {
+ return errors.New("usage: unset {name}")
}
os.Unsetenv(args[1])
break
+ case "set":
+ if len(args) > 1 {
+ set(args)
+ } else {
+ printenv()
+ }
+ break
+ case "exit":
+ if err := exit(args); err != nil {
+ return err
+ }
+ break
case ":":
return nil
}
return nil
}
-
-func chDir(args []string) error {
- var dir string
- if len(args) == 1 {
- dir, _ = os.UserHomeDir()
- } else {
- dir = args[1]
- }
- return os.Chdir(dir)
-}
-
-func export(args []string) error {
- if len(args) == 1 || len(args) >= 3 {
- return errors.New("export: usage: name=value")
- }
- tmp := strings.Split(args[1], "=")
- if len(tmp) != 2 {
- return errors.New("export: usage: name=value")
- }
- return os.Setenv(tmp[0], tmp[1])
-}