zutils/cmd/autodetect.go
selamanapps aeae34365c feat: add zutils v0.2.0 with professional table formatting
- Add directory information with Unicode table borders
- Add network information with professional formatting
- Add version command
- Add comprehensive documentation (README.md, DEVELOPMENT.md)
- Improve table output with proper borders and alignment
- Add project structure (cmd/, pkg/ directories)
2026-05-02 00:05:44 +03:00

25 lines
523 B
Go

package cmd
import (
"fmt"
"os"
"path/filepath"
)
// AutoDetectInfo automatically determines whether the path is a file or directory
func AutoDetectInfo(target string) error {
absPath, err := filepath.Abs(target)
if err != nil {
return fmt.Errorf("error resolving path: %w", err)
}
fileInfo, err := os.Stat(absPath)
if err != nil {
return fmt.Errorf("error accessing %s: %w", absPath, err)
}
if fileInfo.IsDir() {
return DirInfoCommand([]string{absPath})
}
return FileInfoCommand([]string{absPath})
}