Skip to content

Commit b8a97bc

Browse files
Print if it's a file or directory in stat call
1 parent 8c42da9 commit b8a97bc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/builtin/builtin.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,11 @@ func SysStat(ctx context.Context, env []string, input string) (string, error) {
455455
return "", err
456456
}
457457

458-
return fmt.Sprintf("File %s mode: %s, size: %d bytes, modtime: %s", params.Filepath, stat.Mode().String(), stat.Size(), stat.ModTime().String()), nil
458+
title := "File"
459+
if stat.IsDir() {
460+
title = "Directory"
461+
}
462+
return fmt.Sprintf("%s %s mode: %s, size: %d bytes, modtime: %s", title, params.Filepath, stat.Mode().String(), stat.Size(), stat.ModTime().String()), nil
459463
}
460464

461465
func SysDownload(ctx context.Context, env []string, input string) (_ string, err error) {

0 commit comments

Comments
 (0)