1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Allow to define the path of the shell in app preferences

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala 2021-02-19 18:11:03 +02:00
parent 9f15bb9626
commit f9639f0884
3 changed files with 17 additions and 4 deletions

View File

@ -20,6 +20,7 @@ export interface UserStoreModel {
export interface UserPreferences { export interface UserPreferences {
httpsProxy?: string; httpsProxy?: string;
shell?: string;
colorTheme?: string; colorTheme?: string;
allowUntrustedCAs?: boolean; allowUntrustedCAs?: boolean;
allowTelemetry?: boolean; allowTelemetry?: boolean;

View File

@ -105,13 +105,14 @@ export class ShellSession extends EventEmitter {
protected async getShellEnv() { protected async getShellEnv() {
const env = JSON.parse(JSON.stringify(await shellEnv())); const env = JSON.parse(JSON.stringify(await shellEnv()));
const pathStr = [this.kubectlBinDir, this.helmBinDir, process.env.PATH].join(path.delimiter); const pathStr = [this.kubectlBinDir, this.helmBinDir, process.env.PATH].join(path.delimiter);
const shell = userStore.preferences.shell && userStore.preferences.shell !== "" ? userStore.preferences.shell : process.env.SHELL;
if(isWindows) { if(isWindows) {
env["SystemRoot"] = process.env.SystemRoot; env["SystemRoot"] = process.env.SystemRoot;
env["PTYSHELL"] = process.env.SHELL || "powershell.exe"; env["PTYSHELL"] = shell || "powershell.exe";
env["PATH"] = pathStr; env["PATH"] = pathStr;
} else if(typeof(process.env.SHELL) != "undefined") { } else if(typeof(shell) != "undefined") {
env["PTYSHELL"] = process.env.SHELL; env["PTYSHELL"] = shell;
env["PATH"] = pathStr; env["PATH"] = pathStr;
} else { } else {
env["PTYSHELL"] = ""; // blank runs the system default shell env["PTYSHELL"] = ""; // blank runs the system default shell

View File

@ -25,6 +25,7 @@ export class Preferences extends React.Component {
@observable helmRepos: HelmRepo[] = []; @observable helmRepos: HelmRepo[] = [];
@observable helmAddedRepos = observable.map<string, HelmRepo>(); @observable helmAddedRepos = observable.map<string, HelmRepo>();
@observable httpProxy = userStore.preferences.httpsProxy || ""; @observable httpProxy = userStore.preferences.httpsProxy || "";
@observable shell = userStore.preferences.shell || "";
@computed get themeOptions(): SelectOption<string>[] { @computed get themeOptions(): SelectOption<string>[] {
return themeStore.themes.map(theme => ({ return themeStore.themes.map(theme => ({
@ -130,7 +131,17 @@ export class Preferences extends React.Component {
<small className="hint"> <small className="hint">
Proxy is used only for non-cluster communication. Proxy is used only for non-cluster communication.
</small> </small>
<h2>Terminal Shell</h2>
<Input
theme="round-black"
placeholder={process.env.SHELL}
value={this.shell}
onChange={v => this.shell = v}
onBlur={() => preferences.shell = this.shell}
/>
<small className="hint">
The path of the shell that the terminal uses.
</small>
<KubectlBinaries preferences={preferences}/> <KubectlBinaries preferences={preferences}/>
<h2>Helm</h2> <h2>Helm</h2>