2
3
Fork 0
A simple shell with simple goals https://git.rawtext.club/sloum/slosh
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
510 B

package main
import (
"fmt"
"io/ioutil"
"strings"
)
func getRcLines(path string) ([]string, error) {
fdata, err := ioutil.ReadFile(path)
if err != nil {
return []string{}, fmt.Errorf("Unable to read slosh file at: %s\n", path)
}
return strings.Split(string(fdata), "\n"), nil
}
func parseRcLines(lines []string) {
for _, line := range lines {
line = strings.TrimSpace(line)
if len(line) == 0 || line[0] == '#' {
continue
}
command, _ := ParseCommandLine(line)
command.Execute()
}
}