Skip to content

Commit

Permalink
builtin cd goes os.Getenv("HOME") if no args
Browse files Browse the repository at this point in the history
  • Loading branch information
aerth committed Mar 3, 2016
1 parent 45a4059 commit 4713b5f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions applets/shell/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ func pwd(call []string) error {
}

func cd(call []string) error {
if len(call) == 1 {
e := os.Chdir(os.Getenv("HOME"))
return e
}
if call[1] == "~" && len(call) == 2 {
e := os.Chdir(os.Getenv("HOME"))
return e
}
if len(call) != 2 {
return errors.New("`cd <directory>`")
}
Expand Down

0 comments on commit 4713b5f

Please sign in to comment.