MCPcopy Index your code
hub / github.com/anomalyco/opencode / pagerCmd

Function pagerCmd

packages/opencode/src/cli/cmd/session.ts:17–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15import { which } from "@opencode-ai/core/util/which"
16
17function pagerCmd(): string[] {
18 const lessOptions = ["-R", "-S"]
19 if (process.platform !== "win32") {
20 return ["less", ...lessOptions]
21 }
22
23 // user could have less installed via other options
24 const lessOnPath = which("less")
25 if (lessOnPath) {
26 if (Filesystem.stat(lessOnPath)?.size) return [lessOnPath, ...lessOptions]
27 }
28
29 if (Flag.OPENCODE_GIT_BASH_PATH) {
30 const less = path.join(Flag.OPENCODE_GIT_BASH_PATH, "..", "..", "usr", "bin", "less.exe")
31 if (Filesystem.stat(less)?.size) return [less, ...lessOptions]
32 }
33
34 const git = which("git")
35 if (git) {
36 const less = path.join(git, "..", "..", "usr", "bin", "less.exe")
37 if (Filesystem.stat(less)?.size) return [less, ...lessOptions]
38 }
39
40 // Fall back to Windows built-in more (via cmd.exe)
41 return ["cmd", "/c", "more"]
42}
43
44export const SessionCommand = cmd({
45 command: "session",

Callers 1

session.tsFile · 0.85

Calls 1

whichFunction · 0.90

Tested by

no test coverage detected