@@ -674,6 +674,7 @@ func handleSniff() {
674674 var projectPath , configPath string
675675 var verbose bool
676676 var format string = "yml-config" // default format
677+ var customProjectName string
677678
678679 // Parse flags first and collect non-flag arguments
679680 args := os .Args [2 :] // Skip 'sitedog' and 'sniff'
@@ -689,6 +690,13 @@ func handleSniff() {
689690 // Skip the next argument in the next iteration
690691 args [i + 1 ] = ""
691692 }
693+ } else if arg == "--set-name" {
694+ // Get custom project name from next argument
695+ if i + 1 < len (args ) {
696+ customProjectName = args [i + 1 ]
697+ // Skip the next argument in the next iteration
698+ args [i + 1 ] = ""
699+ }
692700 } else if arg != "" {
693701 // This is a path argument, not a flag
694702 pathArgs = append (pathArgs , arg )
@@ -872,7 +880,7 @@ func handleSniff() {
872880 switch format {
873881 case "yml-config" :
874882 // Create or update configuration (default behavior)
875- createConfigFromDetectorResults (configPath , allResults )
883+ createConfigFromDetectorResults (configPath , allResults , customProjectName )
876884 case "json-stdout" :
877885 // Output rich JSON format to stdout
878886 outputJSONFormat (allResults , detectedLanguages , stackData )
@@ -1405,13 +1413,18 @@ func getTechnologyDisplayName(techKey, url string) string {
14051413 return strings .Title (techKey )
14061414}
14071415
1408- func createConfigFromDetectorResults (configPath string , results map [string ]string ) {
1409- // Get project name from directory
1410- projectDir := filepath .Dir (configPath )
1411- projectName := filepath .Base (projectDir )
1412- if projectDir == "." {
1413- if cwd , err := os .Getwd (); err == nil {
1414- projectName = filepath .Base (cwd )
1416+ func createConfigFromDetectorResults (configPath string , results map [string ]string , customProjectName string ) {
1417+ // Get project name - use custom name if provided, otherwise derive from directory
1418+ var projectName string
1419+ if customProjectName != "" {
1420+ projectName = customProjectName
1421+ } else {
1422+ projectDir := filepath .Dir (configPath )
1423+ projectName = filepath .Base (projectDir )
1424+ if projectDir == "." {
1425+ if cwd , err := os .Getwd (); err == nil {
1426+ projectName = filepath .Base (cwd )
1427+ }
14151428 }
14161429 }
14171430
0 commit comments