squash-only 3.0.6 → 3.0.7

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/README.md CHANGED
@@ -194,6 +194,7 @@ npx github:pRizz/squash-only --force --sleep 0.5
194
194
 
195
195
  - `-s, --sleep SECONDS` - Set the sleep interval between API requests (default: 0.1 seconds). This delay helps prevent triggering GitHub's rate limits. Authenticated requests (OAuth or PAT) are limited to ~5,000 requests per hour per user or app. See [GitHub's API rate limits documentation](https://github.com/orgs/community/discussions/163553) for more details.
196
196
  - `-f, --force` - Process all repositories, including those already configured for squash-only (default: skip already configured repos)
197
+ - `-v, --verbose` - Print per-repo skip lines (default: skipped repos render as compact dots to reduce output spam)
197
198
 
198
199
  ## Features
199
200
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squash-only",
3
- "version": "3.0.6",
3
+ "version": "3.0.7",
4
4
  "description": "Scripts for making all your repos on GitHub Squash Only!",
5
5
  "bin": {
6
6
  "squash-only": "bin/squash-only.js"
@@ -14,6 +14,12 @@ ALREADY_SQUASH_ONLY_COUNT_FILE=$(mktemp)
14
14
  # Flag to force processing all repos even if they already have squash-only enabled
15
15
  FORCE_FLAG=0
16
16
 
17
+ # Verbose output (prints a full line for skipped repos)
18
+ VERBOSE_FLAG=0
19
+
20
+ # When not verbose, we print compact skip indicators (dots) without newlines.
21
+ IN_COMPACT_SKIP_LINE=0
22
+
17
23
  cleanup() {
18
24
  rm -f "$SUCCESS_COUNT_FILE" "$SKIP_COUNT_FILE" "$FAILED_COUNT_FILE" "$ALREADY_SQUASH_ONLY_COUNT_FILE"
19
25
  }
@@ -28,10 +34,37 @@ handle_exit() {
28
34
 
29
35
  SHOULD_EXIT=1
30
36
  echo ""
37
+ IN_COMPACT_SKIP_LINE=0
31
38
  echo "⚠️ Interrupted. Finishing current step then stopping..."
32
39
  }
33
40
  trap handle_exit INT TERM
34
41
 
42
+ maybe_end_compact_skip_line() {
43
+ if [ "${IN_COMPACT_SKIP_LINE:-0}" -eq 1 ]; then
44
+ echo ""
45
+ IN_COMPACT_SKIP_LINE=0
46
+ fi
47
+ }
48
+
49
+ print_compact_skip_indicator() {
50
+ # Print a dot to indicate a skipped repo without spamming the terminal.
51
+ printf "."
52
+ IN_COMPACT_SKIP_LINE=1
53
+ }
54
+
55
+ print_skip_repo() {
56
+ local repo=$1
57
+ local reason=$2
58
+
59
+ if [ "$VERBOSE_FLAG" -eq 1 ]; then
60
+ echo "────────────────────────────────────"
61
+ echo "⏭️ Skipping repo: $repo ($reason)"
62
+ return 0
63
+ fi
64
+
65
+ print_compact_skip_indicator
66
+ }
67
+
35
68
  require_cmd() {
36
69
  local cmd=$1
37
70
  if ! command -v "$cmd" &> /dev/null; then
@@ -142,20 +175,19 @@ process_repo() {
142
175
  fi
143
176
 
144
177
  if [ "$owner" != "$GITHUB_USER" ]; then
145
- echo "────────────────────────────────────"
146
- echo "⏭️ Skipping repo: $repo (owned by $owner)"
178
+ print_skip_repo "$repo" "owned by $owner"
147
179
  increment_counter "$SKIP_COUNT_FILE"
148
180
  return 0
149
181
  fi
150
182
 
151
183
  # Check if repo already has squash-only enabled
152
184
  if [ "$FORCE_FLAG" -eq 0 ] && is_squash_only "$allow_squash_merge" "$allow_merge_commit" "$allow_rebase_merge"; then
153
- echo "────────────────────────────────────"
154
- echo "⏭️ Skipping repo: $repo (already squash-only)"
185
+ print_skip_repo "$repo" "already squash-only"
155
186
  increment_counter "$ALREADY_SQUASH_ONLY_COUNT_FILE"
156
187
  return 0
157
188
  fi
158
189
 
190
+ maybe_end_compact_skip_line
159
191
  echo "────────────────────────────────────"
160
192
  if [ "$FORCE_FLAG" -eq 1 ] && is_squash_only "$allow_squash_merge" "$allow_merge_commit" "$allow_rebase_merge"; then
161
193
  echo "Updating repo: $repo (forced, already squash-only)"
@@ -391,9 +423,13 @@ parse_args() {
391
423
  FORCE_FLAG=1
392
424
  shift
393
425
  ;;
426
+ -v|--verbose)
427
+ VERBOSE_FLAG=1
428
+ shift
429
+ ;;
394
430
  *)
395
431
  echo "❌ Error: Unknown option: $1"
396
- echo "Usage: $0 [--sleep SECONDS] [--force]"
432
+ echo "Usage: $0 [--sleep SECONDS] [--force] [--verbose]"
397
433
  exit 1
398
434
  ;;
399
435
  esac
@@ -446,6 +482,8 @@ main() {
446
482
  fetch_all_repos
447
483
  END_TIME=$(date +%s)
448
484
 
485
+ maybe_end_compact_skip_line
486
+
449
487
  ELAPSED=$((END_TIME - START_TIME))
450
488
  ELAPSED_MIN=$((ELAPSED / 60))
451
489
  ELAPSED_SEC=$((ELAPSED % 60))