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

Function getPackagesAndCommitHash

internal/boxcli/midcobra/telemetry.go:84–107  ·  view source on GitHub ↗
(c *cobra.Command)

Source from the content-addressed store, hash-verified

82}
83
84func getPackagesAndCommitHash(c *cobra.Command) ([]string, string) {
85 configFlag := c.Flag("config")
86 // for shell, run, and add command, path can be set via --config
87 // if --config is not set, default to current directory which is ""
88 // the only exception is the init command, for the path can be set with args
89 // since after running init there will be no packages set in devbox.json
90 // we can safely ignore this case.
91 var path string
92 if configFlag != nil {
93 path = configFlag.Value.String()
94 }
95
96 box, err := devbox.Open(&devopt.Opts{
97 Dir: path,
98 Stderr: os.Stderr,
99 IgnoreWarnings: true,
100 })
101 if err != nil {
102 return []string{}, ""
103 }
104
105 return box.AllPackageNamesIncludingRemovedTriggerPackages(),
106 box.Lockfile().Stdenv().Rev
107}

Callers 2

postRunMethod · 0.85

Calls 5

OpenFunction · 0.92
StdenvMethod · 0.65
LockfileMethod · 0.65
StringMethod · 0.45

Tested by 1