File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,13 +21,17 @@ This creates the necessary directory structure and an empty rules.json file.`,
2121 RunE : func (cmd * cobra.Command , args []string ) error {
2222 color .Cyan ("Initializing rules with format: %s" , format )
2323
24- // Check if rules.json doesn't exist
24+ // Check if rules.json already exists
2525 rulesJSONPath , err := formats .GetRulesJSONPath (format )
2626 if err != nil {
2727 return fmt .Errorf ("failed to get rules.json path: %w" , err )
2828 }
2929
30- if _ , err := os .Stat (rulesJSONPath ); os .IsNotExist (err ) {
30+ if _ , err := os .Stat (rulesJSONPath ); err == nil {
31+ // rules.json already exists - warn the user
32+ color .Yellow ("Warning: %s already exists" , rulesJSONPath )
33+ color .Yellow ("Initialization will skip creating rules.json but may create/update directory structure" )
34+ } else if os .IsNotExist (err ) {
3135 // Check for any top-level folder of the structure ".{folder-name}/rules"
3236 formatFolders , err := formats .FindRulesFormats ()
3337 if err == nil && len (formatFolders ) > 0 {
You can’t perform that action at this time.
0 commit comments