GeezerVison is showing github.com — chore: cleanup flag code (#13389) · un33k/opencode@f66624f
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/opencode/src/flag
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/opencode/src/flag/flag.ts +4-7Lines changed: 4 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -function truthyValue(value: string | undefined) { |
2 | | - const v = value?.toLowerCase() |
3 | | - return v === "true" || v === "1" |
4 | | -} |
5 | | - |
6 | 1 | function truthy(key: string) { |
7 | | - return truthyValue(process.env[key]) |
| 2 | + const value = process.env[key]?.toLowerCase() |
| 3 | + return value === "true" || value === "1" |
8 | 4 | } |
9 | 5 |
|
10 | 6 | export namespace Flag { |
@@ -41,9 +37,10 @@ export namespace Flag { |
41 | 37 | export const OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER = truthy("OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER") |
42 | 38 | export const OPENCODE_EXPERIMENTAL_ICON_DISCOVERY = |
43 | 39 | OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_ICON_DISCOVERY") |
| 40 | + |
44 | 41 | const copy = process.env["OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT"] |
45 | 42 | export const OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT = |
46 | | - copy === undefined ? process.platform === "win32" : truthyValue(copy) |
| 43 | + copy === undefined ? process.platform === "win32" : truthy("OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT") |
47 | 44 | export const OPENCODE_ENABLE_EXA = |
48 | 45 | truthy("OPENCODE_ENABLE_EXA") || OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_EXA") |
49 | 46 | export const OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS = number("OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS") |
|