@tanagram/cli 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/run.go +9 -6
- package/commands/sync.go +9 -6
- package/package.json +1 -1
package/commands/run.go
CHANGED
|
@@ -129,15 +129,13 @@ func Run() error {
|
|
|
129
129
|
// Collect results
|
|
130
130
|
totalPolicies := 0
|
|
131
131
|
for result := range results {
|
|
132
|
-
mu.Lock()
|
|
133
|
-
completed++
|
|
134
|
-
mu.Unlock()
|
|
135
|
-
|
|
136
132
|
if result.err != nil {
|
|
137
133
|
stop <- true
|
|
138
134
|
close(stop)
|
|
139
135
|
time.Sleep(50 * time.Millisecond)
|
|
140
|
-
|
|
136
|
+
mu.Lock()
|
|
137
|
+
fmt.Printf("\r\033[K✗ Failed to process %s\n", result.relPath)
|
|
138
|
+
mu.Unlock()
|
|
141
139
|
return fmt.Errorf("failed to extract policies from %s: %w", result.file, result.err)
|
|
142
140
|
}
|
|
143
141
|
|
|
@@ -149,7 +147,12 @@ func Run() error {
|
|
|
149
147
|
}
|
|
150
148
|
|
|
151
149
|
totalPolicies += len(result.policies)
|
|
152
|
-
|
|
150
|
+
|
|
151
|
+
// Atomic update of counter and output (prevents race with spinner)
|
|
152
|
+
mu.Lock()
|
|
153
|
+
completed++
|
|
154
|
+
fmt.Printf("\r\033[K✓ %s - %d policies\n", result.relPath, len(result.policies))
|
|
155
|
+
mu.Unlock()
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
// Stop spinner
|
package/commands/sync.go
CHANGED
|
@@ -117,15 +117,13 @@ func Sync() error {
|
|
|
117
117
|
// Collect results
|
|
118
118
|
totalPolicies := 0
|
|
119
119
|
for result := range results {
|
|
120
|
-
mu.Lock()
|
|
121
|
-
completed++
|
|
122
|
-
mu.Unlock()
|
|
123
|
-
|
|
124
120
|
if result.err != nil {
|
|
125
121
|
stop <- true
|
|
126
122
|
close(stop)
|
|
127
123
|
time.Sleep(50 * time.Millisecond)
|
|
128
|
-
|
|
124
|
+
mu.Lock()
|
|
125
|
+
fmt.Printf("\r\033[K✗ Failed to process %s\n", result.relPath)
|
|
126
|
+
mu.Unlock()
|
|
129
127
|
return fmt.Errorf("failed to extract policies from %s: %w", result.file, result.err)
|
|
130
128
|
}
|
|
131
129
|
|
|
@@ -137,7 +135,12 @@ func Sync() error {
|
|
|
137
135
|
}
|
|
138
136
|
|
|
139
137
|
totalPolicies += len(result.policies)
|
|
140
|
-
|
|
138
|
+
|
|
139
|
+
// Atomic update of counter and output (prevents race with spinner)
|
|
140
|
+
mu.Lock()
|
|
141
|
+
completed++
|
|
142
|
+
fmt.Printf("\r\033[K✓ %s - %d policies\n", result.relPath, len(result.policies))
|
|
143
|
+
mu.Unlock()
|
|
141
144
|
}
|
|
142
145
|
|
|
143
146
|
// Stop spinner
|