Skip to content

Commit 24ab1b0

Browse files
committed
Add --bell mode for --notify
1 parent 85b1321 commit 24ab1b0

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ prs --notify
4646
- `--include-stale` - Include old PRs (hidden by default)
4747
- `--watch` - Live updates
4848
- `--notify` - Desktop notifications
49+
- `--bell` - Ring ASCII bell for new PRs in notify mode (default: true)
4950
- `--org` - Filter to specific organization
5051
- `--debug` - Show debug info
5152

main.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ func main() {
191191
watchInterval = flag.Duration("watch-interval", defaultWatchInterval, "Watch interval (default: 90s)")
192192
blocked = flag.Bool("blocked", false, "Show only PRs blocking on you")
193193
notify = flag.Bool("notify", false, "Watch for PRs and notify when they become newly blocking")
194+
bell = flag.Bool("bell", true, "Ring ASCII bell when new PRs are found in notify mode")
194195
turnServer = flag.String("turn-server", defaultTurnServerURL, "Turn server URL for enhanced metadata")
195196
org = flag.String("org", "", "Filter PRs to specific organization")
196197
includeStale = flag.Bool("include-stale", false, "Include stale PRs in the output")
@@ -279,7 +280,7 @@ func main() {
279280

280281
// If either watch or notify is set, run in watch mode
281282
if *watch || *notify {
282-
runWatchMode(ctx, token, username, *blocked, *notify, *watchInterval, logger, httpClient, turnClient, debug, *org, *includeStale)
283+
runWatchMode(ctx, token, username, *blocked, *notify, *bell, *watchInterval, logger, httpClient, turnClient, debug, *org, *includeStale)
283284
} else {
284285
// One-time display
285286
prs, err := fetchPRsWithRetry(ctx, token, username, logger, httpClient, turnClient, debug, *org)
@@ -1011,7 +1012,7 @@ func truncateURL(url string, maxLen int) string {
10111012
return truncate(url, maxLen)
10121013
}
10131014

1014-
func runWatchMode(ctx context.Context, token, username string, blockingOnly bool, notifyMode bool, interval time.Duration, logger *log.Logger, httpClient *http.Client, turnClient *turn.Client, debug bool, org string, includeStale bool) {
1015+
func runWatchMode(ctx context.Context, token, username string, blockingOnly bool, notifyMode bool, bell bool, interval time.Duration, logger *log.Logger, httpClient *http.Client, turnClient *turn.Client, debug bool, org string, includeStale bool) {
10151016
// Clear screen only if not in notify mode
10161017
if !notifyMode {
10171018
fmt.Print("\033[H\033[2J")
@@ -1086,6 +1087,9 @@ func runWatchMode(ctx context.Context, token, username string, blockingOnly bool
10861087
}
10871088
}
10881089
for _, pr := range newBlockingPRs {
1090+
if bell {
1091+
fmt.Print("\a") // ASCII bell for attention
1092+
}
10891093
displayPR(pr, username)
10901094
}
10911095
} else {
@@ -1098,6 +1102,9 @@ func runWatchMode(ctx context.Context, token, username string, blockingOnly bool
10981102
}
10991103
}
11001104
for _, pr := range newPRs {
1105+
if bell {
1106+
fmt.Print("\a") // ASCII bell for attention
1107+
}
11011108
displayPR(pr, username)
11021109
}
11031110
}

prs

16.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)