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

Method Info

internal/devbox/devbox.go:418–460  ·  view source on GitHub ↗
(ctx context.Context, pkg string, markdown bool)

Source from the content-addressed store, hash-verified

416}
417
418func (d *Devbox) Info(ctx context.Context, pkg string, markdown bool) (string, error) {
419 ctx, task := trace.NewTask(ctx, "devboxInfo")
420 defer task.End()
421
422 name, version, isVersioned := searcher.ParseVersionedPackage(pkg)
423 if !isVersioned {
424 name = pkg
425 version = "latest"
426 }
427
428 packageVersion, err := searcher.Client().Resolve(name, version)
429 if err != nil {
430 if !errors.Is(err, searcher.ErrNotFound) {
431 return "", usererr.WithUserMessage(err, "Package %q not found\n", pkg)
432 }
433
434 packageVersion = nil
435 // fallthrough to below
436 }
437
438 if packageVersion == nil {
439 return "", usererr.WithUserMessage(err, "Package %q not found\n", pkg)
440 }
441
442 // we should only have one result
443 info := fmt.Sprintf(
444 "%s%s %s\n%s\n",
445 lo.Ternary(markdown, "## ", ""),
446 packageVersion.Name,
447 packageVersion.Version,
448 packageVersion.Summary,
449 )
450 readme, err := plugin.Readme(
451 ctx,
452 devpkg.PackageFromStringWithDefaults(pkg, d.lockfile),
453 d.projectDir,
454 markdown,
455 )
456 if err != nil {
457 return "", err
458 }
459 return info + readme, nil
460}
461
462// GenerateDevcontainer generates devcontainer.json and Dockerfile for vscode run-in-container
463// and GitHub Codespaces

Callers 3

IncludeDevboxConfigFunction · 0.45
copyToProfileMethod · 0.45
infoCmdFuncFunction · 0.45

Calls 8

ParseVersionedPackageFunction · 0.92
ClientFunction · 0.92
WithUserMessageFunction · 0.92
ReadmeFunction · 0.92
EndMethod · 0.80
IsMethod · 0.80
ResolveMethod · 0.65

Tested by

no test coverage detected