Skip to content

Commit 338478a

Browse files
committed
no confirmation for rules install
1 parent f7960c3 commit 338478a

2 files changed

Lines changed: 2 additions & 28 deletions

File tree

cmd/install.go

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ import (
1515
"github.com/spf13/cobra"
1616
)
1717

18-
var (
19-
forceInstall bool
20-
)
21-
2218
// installCmd represents the install command
2319
var installCmd = &cobra.Command{
2420
Use: "install",
@@ -29,8 +25,7 @@ Performs a clean installation by:
2925
- Re-downloading and installing all rules specified in rules.json
3026
3127
This ensures the rules directory matches exactly what's defined in rules.json.`,
32-
Example: ` rules install
33-
rules install --force`,
28+
Example: ` rules install`,
3429
RunE: func(cmd *cobra.Command, args []string) error {
3530
// Get rules directory for the format
3631
rulesDir, err := formats.GetRulesDirectory(format)
@@ -82,21 +77,7 @@ This ensures the rules directory matches exactly what's defined in rules.json.`,
8277

8378
// Check if rules directory exists
8479
if _, err := os.Stat(rulesDir); err == nil {
85-
// Directory exists, check if we should clean it
86-
if !forceInstall {
87-
color.Yellow("This will remove all existing rules in '%s' and reinstall them from rules.json.", rulesDir)
88-
fmt.Print("Continue? (y/N): ")
89-
90-
var response string
91-
fmt.Scanln(&response)
92-
93-
if strings.ToLower(response) != "y" {
94-
color.Yellow("Installation cancelled.")
95-
return nil
96-
}
97-
}
98-
99-
// Remove all files and directories in the rules directory
80+
// Directory exists, clean it without confirmation
10081
color.Cyan("Removing existing rules from '%s'...", rulesDir)
10182
if err := removeContents(rulesDir); err != nil {
10283
return fmt.Errorf("failed to clean rules directory: %w", err)
@@ -191,7 +172,4 @@ func removeContents(dir string) error {
191172

192173
func init() {
193174
rootCmd.AddCommand(installCmd)
194-
195-
// Add flags
196-
installCmd.Flags().BoolVar(&forceInstall, "force", false, "Skip confirmation prompts")
197175
}

spec/index.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,12 @@ Synchronizes the `.rules` directory with the contents of `rules.json`.
172172

173173
```bash
174174
rules install
175-
rules install --force # Skip confirmation prompts
176175
```
177176

178-
- **Flags**:
179-
- `--force`: Skip confirmation prompts
180177
- **Behavior**:
181178
- Performs a clean installation by:
182179
- Removing all existing rule files and directories first
183180
- Re-downloading and installing all rules specified in `rules.json`
184-
- Provides confirmation prompt before deleting existing rules
185181
- Ensures the `.rules` directory exactly matches what's defined in `rules.json`
186182
- Reports on installation progress and any errors encountered
187183

0 commit comments

Comments
 (0)