MCPcopy Index your code
hub / github.com/SignTools/SignTools / refresh

Method refresh

src/storage/profile_resolver.go:22–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20}
21
22func (r *profileResolver) refresh() error {
23 idDirs, err := os.ReadDir(profilesPath)
24 if err != nil {
25 return errors.WithMessage(err, "read profiles dir")
26 }
27 idDirs = util.RemoveHiddenDirs(idDirs)
28 envProfile, err := newEnvProfile(config.Current.EnvProfile)
29 if err == nil {
30 r.idToProfileMap[envProfile.GetId()] = envProfile
31 } else if !os.IsNotExist(err) {
32 return errors.WithMessage(err, "import profile from envvars")
33 }
34 for _, idDir := range idDirs {
35 id := idDir.Name()
36 profile, err := loadProfile(id)
37 if err != nil {
38 log.Fatal().Err(err).Str("id", id).Msg("load profile from files")
39 }
40 r.idToProfileMap[id] = profile
41 }
42 return nil
43}
44
45func (r *profileResolver) GetAll() ([]Profile, error) {
46 var profiles []Profile

Callers

nothing calls this directly

Calls 5

RemoveHiddenDirsFunction · 0.92
newEnvProfileFunction · 0.85
loadProfileFunction · 0.85
ReadDirMethod · 0.65
GetIdMethod · 0.65

Tested by

no test coverage detected