From 51528c33e9dfadaf7de650dfc8c598ced3bd9bc8 Mon Sep 17 00:00:00 2001 From: rekram1-node Date: Sun, 23 Aug 2026 17:56:55 +0000 Subject: [PATCH] refactor(core): remove acceptable shell terminology --- packages/app/src/settings/general/behavior.ts | 4 ++-- .../app/src/settings/general/controllers.test.ts | 6 +++--- packages/core/src/shell/select.ts | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/app/src/settings/general/behavior.ts b/packages/app/src/settings/general/behavior.ts index 64bd4c11875..d6d782b6b1a 100644 --- a/packages/app/src/settings/general/behavior.ts +++ b/packages/app/src/settings/general/behavior.ts @@ -3,7 +3,7 @@ import { onCleanup } from "solid-js" export type ShellOption = { path: string name: string - acceptable: boolean + compatible: boolean } export type ShellSelectOption = { @@ -27,7 +27,7 @@ export function createShellOptions(input: { shells: ShellOption[]; current: stri id: shell.path, value: ambiguous ? shell.path : shell.name, name, - terminalOnly: !shell.acceptable, + terminalOnly: !shell.compatible, } }), ] diff --git a/packages/app/src/settings/general/controllers.test.ts b/packages/app/src/settings/general/controllers.test.ts index 36d4fc58c54..f6e3b6f29c4 100644 --- a/packages/app/src/settings/general/controllers.test.ts +++ b/packages/app/src/settings/general/controllers.test.ts @@ -7,9 +7,9 @@ describe("settings controllers", () => { expect( createShellOptions({ shells: [ - { path: "/bin/bash", name: "bash", acceptable: true }, - { path: "/opt/bash", name: "bash", acceptable: false }, - { path: "/bin/zsh", name: "zsh", acceptable: true }, + { path: "/bin/bash", name: "bash", compatible: true }, + { path: "/opt/bash", name: "bash", compatible: false }, + { path: "/bin/zsh", name: "zsh", compatible: true }, ], current: "fish", }), diff --git a/packages/core/src/shell/select.ts b/packages/core/src/shell/select.ts index d98d64af918..d02aa82b24e 100644 --- a/packages/core/src/shell/select.ts +++ b/packages/core/src/shell/select.ts @@ -25,7 +25,7 @@ const META: Record = export type Item = { path: string name: string - acceptable: boolean + compatible: boolean } export const Options = Schema.Struct({ @@ -74,7 +74,7 @@ function meta(file: string) { return META[name(file)] } -function ok(file: string) { +function compatible(file: string) { return meta(file)?.deny !== true } @@ -112,8 +112,8 @@ async function unix() { return ["/bin/bash", "/bin/zsh", "/bin/sh"] } -function select(file: string | undefined, options?: Options, opts?: { acceptable?: boolean }, bin?: string) { - if (file && (!opts?.acceptable || ok(file))) { +function select(file: string | undefined, options?: Options, opts?: { compatible?: boolean }, bin?: string) { + if (file && (!opts?.compatible || compatible(file))) { const shell = executable(file, options, bin) if (shell) return shell } @@ -156,7 +156,7 @@ function info(file: string, options?: Options, bin?: string): Item { return { path: item, name: executable(n, options, bin) ? n : item, - acceptable: ok(item), + compatible: compatible(item), } } @@ -171,7 +171,7 @@ let defaultConfigured: { bin?: string; value: string } | undefined let defaultCompatible: { bin?: string; value: string } | undefined export function resolve(input: ResolveInput, configShell?: string, options?: Options, bin?: string) { - const filter = input.preference === "compatible" ? { acceptable: true } : undefined + const filter = input.preference === "compatible" ? { compatible: true } : undefined if (configShell) return select(configShell, options, filter, bin) if (options?.gitbash) return select(process.env.SHELL, options, filter, bin) const cached = input.preference === "compatible" ? defaultCompatible : defaultConfigured