chore: refactor code

- remove legacy code
- refactor search and add tests
This commit is contained in:
2025-02-22 09:44:59 +03:00
parent 88b8d2fbf3
commit 9bb14312bd
28 changed files with 421 additions and 665 deletions

View File

@ -152,6 +152,13 @@ func (c *ALRConfig) Repos(ctx context.Context) []types.Repo {
return c.cfg.Repos
}
func (c *ALRConfig) SetRepos(ctx context.Context, repos []types.Repo) {
c.cfgOnce.Do(func() {
c.Load(ctx)
})
c.cfg.Repos = repos
}
func (c *ALRConfig) IgnorePkgUpdates(ctx context.Context) []string {
c.cfgOnce.Do(func() {
c.Load(ctx)
@ -172,3 +179,17 @@ func (c *ALRConfig) PagerStyle(ctx context.Context) string {
})
return c.cfg.PagerStyle
}
func (c *ALRConfig) AllowRunAsRoot(ctx context.Context) bool {
c.cfgOnce.Do(func() {
c.Load(ctx)
})
return c.cfg.Unsafe.AllowRunAsRoot
}
func (c *ALRConfig) RootCmd(ctx context.Context) string {
c.cfgOnce.Do(func() {
c.Load(ctx)
})
return c.cfg.RootCmd
}