- 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)
25 lines
523 B
Go
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})
|
|
}
|