diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-22 20:54:20 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-22 20:54:20 +0200 |
| commit | fb6f9434eaf353375b20a13966946d3a230d93d5 (patch) | |
| tree | 4a481907a77e50c0564c4a572368e1133f796018 /web | |
| parent | 086a0cc0eb75c0c3a15cf6a715427df1e2d589a2 (diff) | |
testooooo
Diffstat (limited to 'web')
| -rw-r--r-- | web/coverage.html | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/web/coverage.html b/web/coverage.html index 44d8836..a1ad2d0 100644 --- a/web/coverage.html +++ b/web/coverage.html @@ -61,7 +61,7 @@ <option value="file2">pik/describe/describe.go (96.9%)</option> - <option value="file3">pik/env/env.go (0.0%)</option> + <option value="file3">pik/env/env.go (88.0%)</option> <option value="file4">pik/git/git.go (0.0%)</option> @@ -433,51 +433,52 @@ import ( "slices" ) -func IsEnv(file string) bool <span class="cov0" title="0">{ +func IsEnv(file string) bool <span class="cov8" title="1">{ options := []string{ ".env", } - for _, e := range *flags.Env </span><span class="cov0" title="0">{ + for _, e := range *flags.Env </span><span class="cov8" title="1">{ options = append(options, ".env-"+e, ".env."+e, - e+".env") + e+".env", + "."+e+".env") }</span> - <span class="cov0" title="0">return slices.Contains(options, file)</span> + <span class="cov8" title="1">return slices.Contains(options, file)</span> } -func EnvFiles(f fs.FS, p string, deep bool) []string <span class="cov0" title="0">{ +func EnvFiles(f fs.FS, p string, deep bool) []string <span class="cov8" title="1">{ var result []string dir, err := fs.ReadDir(f, p) if err != nil </span><span class="cov0" title="0">{ return nil }</span> - <span class="cov0" title="0">for _, e := range dir </span><span class="cov0" title="0">{ - if e.IsDir() && slices.Contains(pikdex.Roots, e.Name()) && deep </span><span class="cov0" title="0">{ + <span class="cov8" title="1">for _, e := range dir </span><span class="cov8" title="1">{ + if e.IsDir() && slices.Contains(pikdex.Roots, e.Name()) && deep </span><span class="cov8" title="1">{ result = append(result, EnvFiles(f, e.Name(), false)...) }</span> - <span class="cov0" title="0">if !e.IsDir() && IsEnv(e.Name()) </span><span class="cov0" title="0">{ + <span class="cov8" title="1">if !e.IsDir() && IsEnv(e.Name()) </span><span class="cov8" title="1">{ result = append(result, filepath.Join(p, e.Name())) }</span> } - <span class="cov0" title="0">return result</span> + <span class="cov8" title="1">return result</span> } -func Get(src *model.Source) []string <span class="cov0" title="0">{ +func Get(src *model.Source) []string <span class="cov8" title="1">{ f := os.DirFS(src.Path) var result []string files := EnvFiles(f, ".", true) - for _, f := range files </span><span class="cov0" title="0">{ + for _, f := range files </span><span class="cov8" title="1">{ res, err := godotenv.Read(filepath.Join(src.Path, f)) if err != nil </span><span class="cov0" title="0">{ spool.Warn("%v", err) continue</span> } - <span class="cov0" title="0">for k, v := range res </span><span class="cov0" title="0">{ + <span class="cov8" title="1">for k, v := range res </span><span class="cov8" title="1">{ result = append(result, k+"="+v) }</span> } - <span class="cov0" title="0">return result</span> + <span class="cov8" title="1">return result</span> } </pre> |
