MCPcopy
hub / github.com/jetify-com/devbox / Readme

Function Readme

internal/plugin/info.go:19–60  ·  view source on GitHub ↗
(ctx context.Context,
	pkg *devpkg.Package,
	projectDir string,
	markdown bool,
)

Source from the content-addressed store, hash-verified

17)
18
19func Readme(ctx context.Context,
20 pkg *devpkg.Package,
21 projectDir string,
22 markdown bool,
23) (string, error) {
24 defer trace.StartRegion(ctx, "Readme").End()
25
26 cfg, err := getConfigIfAny(pkg, projectDir)
27 if err != nil {
28 return "", err
29 }
30
31 if cfg == nil {
32 return "", nil
33 }
34
35 buf := bytes.NewBuffer(nil)
36
37 _, _ = fmt.Fprintln(buf, "")
38
39 if err = printReadme(cfg, buf, markdown); err != nil {
40 return "", err
41 }
42
43 if err = printServices(cfg, pkg, buf, markdown); err != nil {
44 return "", err
45 }
46
47 if err = printCreateFiles(cfg, buf, markdown); err != nil {
48 return "", err
49 }
50
51 if err = printEnv(cfg, buf, markdown); err != nil {
52 return "", err
53 }
54
55 if err = printInfoInstructions(pkg.CanonicalName(), buf); err != nil {
56 return "", err
57 }
58
59 return buf.String(), nil
60}
61
62func printReadme(cfg *Config, w io.Writer, markdown bool) error {
63 if cfg.Description() == "" {

Callers 2

printPostAddMessageMethod · 0.92
InfoMethod · 0.92

Calls 9

getConfigIfAnyFunction · 0.85
printReadmeFunction · 0.85
printServicesFunction · 0.85
printCreateFilesFunction · 0.85
printEnvFunction · 0.85
printInfoInstructionsFunction · 0.85
EndMethod · 0.80
CanonicalNameMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected