feat: init cmd-hook and move terminal-service to services directory

feat: put cmd-hook in container

feat: cmd-hook request type, auto restart setup

feat: handle ls
This commit is contained in:
Justin Lin committed 2025-05-05 19:51:06 +08:00
1 parent 58b6448c3d
commit 0b08a9a5d9
16 files changed
+343 -21

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
package main
import (
"os"
"path/filepath"
)
type FileType string
const (
FileTypeFile FileType = "file"
FileTypeDir FileType = "directory"
)
func resolvePath(path string) string {
if filepath.IsAbs(path) {
return path
}
return filepath.Join(os.Getenv("PWD"), path)
}
func fileExists(path string) (FileType, error) {
fileInfo, err := os.Stat(path)
if err != nil {
return "", err
}
if fileInfo.IsDir() {
return FileTypeDir, nil
}
return FileTypeFile, nil
}
func isDir(path string) bool {
info, err := os.Stat(path)
if err != nil {
return false
}
return info.IsDir()
}