2
3
Fork 0
Browse Source

Adds /etc/slosh to bootup for login shells and fixes history memory between sessions

master
sloum 12 months ago
parent
commit
681137eb46
  1. 1
      TODO.md
  2. 18
      builtins.go
  3. 7
      main.go

1
TODO.md

@ -0,0 +1 @@
- Add printing `/etc/motd`, if it exists, when using a login shell

18
builtins.go

@ -84,19 +84,23 @@ func SetLocal(items []string) error {
func LoadSloshFiles() error {
alias = map[string]CommandLine{}
if IsLoginShell {
sloshSysProfile := filepath.Join("/etc", "slosh")
lines, err := getRcLines(sloshSysProfile)
if err == nil {
parseRcLines(lines)
}
loginSloshFile := filepath.Join(HomeDir(), ".slosh")
lines, err := getRcLines(loginSloshFile)
if err != nil {
return err
lines, err = getRcLines(loginSloshFile)
if err == nil {
parseRcLines(lines)
}
parseRcLines(lines)
}
interactiveSloshFile := filepath.Join(HomeDir(), ".sloshrc")
lines, err := getRcLines(interactiveSloshFile)
if err != nil {
return err
if err == nil {
parseRcLines(lines)
}
parseRcLines(lines)
return nil
}

7
main.go

@ -188,6 +188,8 @@ func handleSignals(c <-chan os.Signal) {
}
func main() {
if os.Args[0][0] == '-' {
IsLoginShell = true
@ -216,4 +218,9 @@ func main() {
entry, _ := ParseCommandLine(in)
entry.Execute()
}
if f, e := os.Create(ExpandedAbsFilepath(History_Filename)); e == nil {
ln.WriteHistory(f)
f.Close()
}
}

Loading…
Cancel
Save