added ~ as home processing

This commit is contained in:
JISAUAY committed 2025-06-27 11:23:15 -05:00
1 parent 7062e798a9
commit 9e46cc9105
7 files changed
+79 -6

No files matched your search

+6 -2
View File
@@ -2,13 +2,17 @@ package cmd
import (
"gosh/types"
"gosh/util"
"os"
"github.com/fatih/color"
)
func GoshCat(sh *types.Shell, filename string) types.CmdOutput {
data, err := os.ReadFile(filename)
func GoshCat(sh *types.Shell, file_path string) types.CmdOutput {
file_path = util.ExpandHome(file_path)
data, err := os.ReadFile(file_path)
red := color.New(color.FgRed).SprintFunc()
if err != nil {
return types.CmdOutput{Id: 1, Output: red(err)}