23 lines
361 B
Go
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))
|
|
|
|
}
|
|
|
|
|