Add more QoL and high prio features
This commit is contained in:
37
main.go
37
main.go
@@ -4,6 +4,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
@@ -20,14 +21,18 @@ func main() {
|
||||
repo = flag.String("repo", "", "optional GitHub repository filter as owner/name (or GH_REPO)")
|
||||
poll = flag.Duration("poll", defaults.RefreshInterval.Duration, "refresh interval")
|
||||
showAll = flag.Bool("all", defaults.ShowAll, "show all open PRs in --repo, not only PRs assigned to you")
|
||||
limit = flag.Int("limit", defaults.Limit, "maximum open PRs to load (1-100)")
|
||||
limit = flag.Int("limit", defaults.Limit, "maximum open PRs to load (1-1000)")
|
||||
endpoint = flag.String("endpoint", defaults.Endpoint, "GitHub GraphQL endpoint")
|
||||
theme = flag.String("theme", defaults.Theme, "color theme: dark or light")
|
||||
theme = flag.String("theme", defaults.Theme, "color theme: dark, light, high-contrast, or no-color")
|
||||
foldResolved = flag.Bool("fold-resolved", defaults.Display.FoldResolved, "start resolved threads folded")
|
||||
listWidth = flag.Int("thread-list-width", defaults.Display.ThreadListWidthPercent, "thread list width as terminal percentage (20-60)")
|
||||
dashboardMode = flag.String("dashboard-mode", defaults.Display.DashboardMode, "dashboard navigation: intermediate or hotkey")
|
||||
compactReviews = flag.Bool("compact-reviews", defaults.Display.CompactReviews, "aggregate submitted review history")
|
||||
pathScroll = flag.Bool("path-scroll", defaults.Paths.Scroll, "scroll truncated paths")
|
||||
pathScrollRate = flag.Duration("path-scroll-interval", defaults.Paths.ScrollInterval.Duration, "path scrolling interval")
|
||||
cacheEnabled = flag.Bool("cache", defaults.Cache.Enabled, "enable local read cache fallback")
|
||||
cacheMaxAge = flag.Duration("cache-max-age", defaults.Cache.MaxAge.Duration, "maximum offline cache age (0 disables expiry)")
|
||||
cacheDir = flag.String("cache-dir", defaults.Cache.Directory, "local read cache directory")
|
||||
)
|
||||
flag.Parse()
|
||||
|
||||
@@ -66,12 +71,24 @@ func main() {
|
||||
if visited["dashboard-mode"] {
|
||||
config.Display.DashboardMode = *dashboardMode
|
||||
}
|
||||
if visited["compact-reviews"] {
|
||||
config.Display.CompactReviews = *compactReviews
|
||||
}
|
||||
if visited["path-scroll"] {
|
||||
config.Paths.Scroll = *pathScroll
|
||||
}
|
||||
if visited["path-scroll-interval"] {
|
||||
config.Paths.ScrollInterval.Duration = *pathScrollRate
|
||||
}
|
||||
if visited["cache"] {
|
||||
config.Cache.Enabled = *cacheEnabled
|
||||
}
|
||||
if visited["cache-max-age"] {
|
||||
config.Cache.MaxAge.Duration = *cacheMaxAge
|
||||
}
|
||||
if visited["cache-dir"] {
|
||||
config.Cache.Directory = *cacheDir
|
||||
}
|
||||
if err := validateConfig(config); err != nil {
|
||||
exitf("configuration: %v", err)
|
||||
}
|
||||
@@ -93,12 +110,26 @@ func main() {
|
||||
}
|
||||
|
||||
client := NewGitHubClient(config.Endpoint, token)
|
||||
var service GitHubService = client
|
||||
if config.Cache.Enabled {
|
||||
cacheDir := config.Cache.Directory
|
||||
if cacheDir == "" {
|
||||
cacheDir, err = defaultCacheDir()
|
||||
if err != nil {
|
||||
exitf("configuration: %v", err)
|
||||
}
|
||||
}
|
||||
service = NewCachedGitHubService(client, cacheDir, config.Cache.MaxAge.Duration)
|
||||
}
|
||||
statePath := filepath.Join(filepath.Dir(*configFile), "state.json")
|
||||
app := NewAppWithSettings(
|
||||
client, owner, name, config.ShowAll, config.Limit, config.RefreshInterval.Duration,
|
||||
service, owner, name, config.ShowAll, config.Limit, config.RefreshInterval.Duration,
|
||||
AppSettings{
|
||||
FoldResolved: config.Display.FoldResolved,
|
||||
ThreadListWidthPercent: config.Display.ThreadListWidthPercent,
|
||||
DashboardMode: config.Display.DashboardMode,
|
||||
CompactReviews: config.Display.CompactReviews,
|
||||
ReadState: loadReadState(statePath),
|
||||
PathScroll: config.Paths.Scroll,
|
||||
PathScrollInterval: config.Paths.ScrollInterval.Duration,
|
||||
ThreadStatusOrder: config.Threads.StatusOrder,
|
||||
|
||||
Reference in New Issue
Block a user