package cmd import ( "os" "gosh/types" "gosh/utils" "github.com/fatih/color" ) func GoshCd(sh *types.Shell, dir string) types.CmdOutput { dir = utils.ExpandHome(dir) err := os.Chdir(dir) red := color.New(color.FgRed).SprintFunc() if err != nil { return types.CmdOutput{Id: 1, Output: red(err)} } dir, _ = os.Getwd() sh.Cd = dir return types.CmdOutput{Id: 0, Output: ""} }