bbash/command/cat/cat.go
Tobias P.L Wennberg 15eeadf5d3 initial
2025-01-10 13:29:56 +01:00

23 lines
361 B
Go

package cat
import (
"bbash/environment"
"bbash/input_parser"
"fmt"
"os"
"path/filepath"
)
func Cat(in input_parser.Input, env *environment.Env) {
file := filepath.Join(env.Path, in.Args)
bytea_str, err := os.ReadFile(file)
if err != nil {
fmt.Print(fmt.Sprintf("Error opening file: %s", err.Error()))
return
}
fmt.Print(string(bytea_str))
}