MCPcopy
hub / github.com/urfave/cli / EnsureGfmrunActionFunc

Function EnsureGfmrunActionFunc

scripts/build.go:568–591  ·  view source on GitHub ↗
(ctx context.Context, cmd *cli.Command)

Source from the content-addressed store, hash-verified

566}
567
568func EnsureGfmrunActionFunc(ctx context.Context, cmd *cli.Command) error {
569 topDir := cmd.String("top-dir")
570 gfmrunExe := filepath.Join(topDir, ".local/bin/gfmrun")
571
572 if err := os.Chdir(topDir); err != nil {
573 return err
574 }
575
576 if v, err := sh(ctx, gfmrunExe, "--version"); err == nil && strings.TrimSpace(v) == gfmrunVersion {
577 return nil
578 }
579
580 gfmrunURL, err := url.Parse(
581 fmt.Sprintf(
582 "https://github.com/urfave/gfmrun/releases/download/%[1]s/gfmrun-%[2]s-%[3]s-%[1]s",
583 gfmrunVersion, runtime.GOOS, runtime.GOARCH,
584 ),
585 )
586 if err != nil {
587 return err
588 }
589
590 return downloadFile(gfmrunURL.String(), gfmrunExe, 0o755, 0o755)
591}
592
593func EnsureMkdocsActionFunc(ctx context.Context, cmd *cli.Command) error {
594 if err := os.Chdir(cmd.String("top-dir")); err != nil {

Callers

nothing calls this directly

Calls 4

shFunction · 0.85
downloadFileFunction · 0.85
ParseMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected