@@ -6,6 +6,7 @@ package main
66
77import (
88 "context"
9+ "flag"
910 "fmt"
1011 "log"
1112 "os"
@@ -55,6 +56,7 @@ type App struct {
5556 lastSuccessfulFetch time.Time
5657 turnClient * turn.Client
5758 currentUser * github.User
59+ targetUser string // User to query PRs for (overrides currentUser if set)
5860 previousBlockedPRs map [string ]bool
5961 client * github.Client
6062 cacheDir string
@@ -69,6 +71,11 @@ type App struct {
6971}
7072
7173func main () {
74+ // Parse command line flags
75+ var targetUser string
76+ flag .StringVar (& targetUser , "user" , "" , "GitHub user to query PRs for (defaults to authenticated user)" )
77+ flag .Parse ()
78+
7279 log .SetFlags (log .LstdFlags | log .Lshortfile )
7380 log .Printf ("Starting GitHub PR Monitor (version=%s, commit=%s, date=%s)" , version , commit , date )
7481
@@ -88,6 +95,7 @@ func main() {
8895 cacheDir : cacheDir ,
8996 hideStaleIncoming : true ,
9097 previousBlockedPRs : make (map [string ]bool ),
98+ targetUser : targetUser ,
9199 }
92100
93101 log .Println ("Initializing GitHub clients..." )
@@ -103,6 +111,11 @@ func main() {
103111 }
104112 app .currentUser = user
105113
114+ // Log if we're using a different target user
115+ if app .targetUser != "" && app .targetUser != user .GetLogin () {
116+ log .Printf ("Querying PRs for user '%s' instead of authenticated user '%s'" , app .targetUser , user .GetLogin ())
117+ }
118+
106119 log .Println ("Starting systray..." )
107120 // Create a cancellable context for the application
108121 appCtx , cancel := context .WithCancel (ctx )
@@ -118,7 +131,13 @@ func main() {
118131func (app * App ) onReady (ctx context.Context ) {
119132 log .Println ("System tray ready" )
120133 systray .SetTitle ("Loading PRs..." )
121- systray .SetTooltip ("GitHub PR Monitor" )
134+
135+ // Set tooltip based on whether we're using a custom user
136+ tooltip := "GitHub PR Monitor"
137+ if app .targetUser != "" {
138+ tooltip = fmt .Sprintf ("GitHub PR Monitor - @%s" , app .targetUser )
139+ }
140+ systray .SetTooltip (tooltip )
122141
123142 // Set up click handlers
124143 systray .SetOnClick (func (menu systray.IMenu ) {
@@ -199,7 +218,13 @@ func (app *App) updatePRs(ctx context.Context) {
199218 if ! app .lastSuccessfulFetch .IsZero () {
200219 timeSinceSuccess = time .Since (app .lastSuccessfulFetch ).Round (time .Minute ).String ()
201220 }
202- systray .SetTooltip (fmt .Sprintf ("GitHub PR Monitor - Error: %v\n Last success: %s ago" , err , timeSinceSuccess ))
221+
222+ // Include user in error tooltip
223+ userInfo := ""
224+ if app .targetUser != "" {
225+ userInfo = fmt .Sprintf (" - @%s" , app .targetUser )
226+ }
227+ systray .SetTooltip (fmt .Sprintf ("GitHub PR Monitor%s - Error: %v\n Last success: %s ago" , userInfo , err , timeSinceSuccess ))
203228 return
204229 }
205230
0 commit comments