MCPcopy Index your code
hub / github.com/jetify-com/devbox / cacheInfoCmd

Function cacheInfoCmd

internal/boxcli/cache.go:191–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189}
190
191func cacheInfoCmd() *cobra.Command {
192 return &cobra.Command{
193 Use: "info",
194 Short: "Output information about the nix cache",
195 Args: cobra.ExactArgs(0),
196 RunE: func(cmd *cobra.Command, args []string) error {
197 // TODO(gcurtis): We can also output info about the daemon config status
198 // here
199 caches, err := nixcache.Caches(cmd.Context())
200 if err != nil {
201 return err
202 }
203 if len(caches) == 0 {
204 fmt.Fprintln(cmd.OutOrStdout(), "No cache configured")
205 }
206 for _, cache := range caches {
207 isReadOnly := !slices.Contains(
208 cache.GetPermissions(),
209 nixv1alpha1.Permission_PERMISSION_WRITE,
210 )
211 fmt.Fprintf(
212 cmd.OutOrStdout(),
213 "* %s %s\n",
214 cache.GetUri(),
215 lo.Ternary(isReadOnly, "(read-only)", ""),
216 )
217 }
218 return nil
219 },
220 }
221}

Callers 1

cacheCmdFunction · 0.85

Calls 1

CachesFunction · 0.92

Tested by

no test coverage detected