MCPcopy Index your code
hub / github.com/cheat/cheat / Pager

Function Pager

internal/config/pager.go:10–32  ·  view source on GitHub ↗

Pager attempts to locate a pager that's appropriate for the environment.

()

Source from the content-addressed store, hash-verified

8
9// Pager attempts to locate a pager that's appropriate for the environment.
10func Pager() string {
11
12 // default to `more` on Windows
13 if runtime.GOOS == "windows" {
14 return "more"
15 }
16
17 // if $PAGER is set, return the corresponding pager
18 if os.Getenv("PAGER") != "" {
19 return os.Getenv("PAGER")
20 }
21
22 // Otherwise, search for `pager`, `less`, and `more` on the `$PATH`. If
23 // none are found, return an empty pager.
24 for _, pager := range []string{"pager", "less", "more"} {
25 if path, err := exec.LookPath(pager); err == nil {
26 return path
27 }
28 }
29
30 // default to no pager
31 return ""
32}

Callers 2

ExpandTemplateFunction · 0.92
TestPagerFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestPagerFunction · 0.68