-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautodetect.go
More file actions
36 lines (30 loc) · 843 Bytes
/
autodetect.go
File metadata and controls
36 lines (30 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package cmd
import (
"fmt"
"github.com/stacktodate/stacktodate-cli/cmd/helpers"
"github.com/spf13/cobra"
)
var autodetectCmd = &cobra.Command{
Use: "autodetect [path]",
Short: "Detect project information",
Long: `Scan a directory and detect programming languages, frameworks, and Docker configuration`,
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
// Determine target directory
targetDir := "."
if len(args) > 0 {
targetDir = args[0]
}
fmt.Printf("Scanning directory: %s\n", targetDir)
// Execute detection in target directory
err := helpers.WithWorkingDir(targetDir, func() error {
// Detect project information
info := DetectProjectInfo()
PrintDetectedInfo(info)
return nil
})
if err != nil {
helpers.ExitOnError(err, "failed to scan directory")
}
},
}