19 lines
343 B
Go
19 lines
343 B
Go
package cmd
|
|
|
|
import (
|
|
"gosh/types"
|
|
"os"
|
|
|
|
"github.com/fatih/color"
|
|
)
|
|
|
|
func GoshCat(sh *types.Shell, filename string) types.CmdOutput {
|
|
data, err := os.ReadFile(filename)
|
|
red := color.New(color.FgRed).SprintFunc()
|
|
if err != nil {
|
|
return types.CmdOutput{Id: 1, Output: red(err)}
|
|
}
|
|
|
|
return types.CmdOutput{Id: 0, Output: string(data)}
|
|
}
|