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 (#2194)
Co-authored-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
713ec8c69d
commit
5c6a6e14f5
@ -20,6 +20,7 @@ export interface UserStoreModel {
|
||||
|
||||
export interface UserPreferences {
|
||||
httpsProxy?: string;
|
||||
shell?: string;
|
||||
colorTheme?: string;
|
||||
allowUntrustedCAs?: boolean;
|
||||
allowTelemetry?: boolean;
|
||||
|
||||
@ -105,10 +105,11 @@ export class ShellSession extends EventEmitter {
|
||||
protected async getShellEnv() {
|
||||
const env = JSON.parse(JSON.stringify(await shellEnv()));
|
||||
const pathStr = [this.kubectlBinDir, this.helmBinDir, process.env.PATH].join(path.delimiter);
|
||||
const shell = userStore.preferences.shell || process.env.SHELL || process.env.PTYSHELL;
|
||||
|
||||
if(isWindows) {
|
||||
env["SystemRoot"] = process.env.SystemRoot;
|
||||
env["PTYSHELL"] = process.env.SHELL || "powershell.exe";
|
||||
env["PTYSHELL"] = shell || "powershell.exe";
|
||||
env["PATH"] = pathStr;
|
||||
env["LENS_SESSION"] = "true";
|
||||
const lensWslEnv = "KUBECONFIG/up:LENS_SESSION/u";
|
||||
@ -118,8 +119,8 @@ export class ShellSession extends EventEmitter {
|
||||
} else {
|
||||
env["WSLENV"] = lensWslEnv;
|
||||
}
|
||||
} else if(typeof(process.env.SHELL) != "undefined") {
|
||||
env["PTYSHELL"] = process.env.SHELL;
|
||||
} else if(shell !== undefined) {
|
||||
env["PTYSHELL"] = shell;
|
||||
env["PATH"] = pathStr;
|
||||
} else {
|
||||
env["PTYSHELL"] = ""; // blank runs the system default shell
|
||||
|
||||
@ -6,6 +6,7 @@ import { action, computed, observable } from "mobx";
|
||||
import { Icon } from "../icon";
|
||||
import { Select, SelectOption } from "../select";
|
||||
import { userStore } from "../../../common/user-store";
|
||||
import { isWindows } from "../../../common/vars";
|
||||
import { HelmRepo, repoManager } from "../../../main/helm/helm-repo-manager";
|
||||
import { Input } from "../input";
|
||||
import { Checkbox } from "../checkbox";
|
||||
@ -25,6 +26,7 @@ export class Preferences extends React.Component {
|
||||
@observable helmRepos: HelmRepo[] = [];
|
||||
@observable helmAddedRepos = observable.map<string, HelmRepo>();
|
||||
@observable httpProxy = userStore.preferences.httpsProxy || "";
|
||||
@observable shell = userStore.preferences.shell || "";
|
||||
|
||||
@computed get themeOptions(): SelectOption<string>[] {
|
||||
return themeStore.themes.map(theme => ({
|
||||
@ -109,6 +111,15 @@ export class Preferences extends React.Component {
|
||||
render() {
|
||||
const { preferences } = userStore;
|
||||
const header = <h2>Preferences</h2>;
|
||||
let defaultShell = process.env.SHELL || process.env.PTYSHELL;
|
||||
|
||||
if (!defaultShell) {
|
||||
if (isWindows) {
|
||||
defaultShell = "powershell.exe";
|
||||
} else {
|
||||
defaultShell = "System default shell";
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<PageLayout showOnTop className="Preferences" header={header}>
|
||||
@ -130,7 +141,17 @@ export class Preferences extends React.Component {
|
||||
<small className="hint">
|
||||
Proxy is used only for non-cluster communication.
|
||||
</small>
|
||||
|
||||
<h2>Terminal Shell</h2>
|
||||
<Input
|
||||
theme="round-black"
|
||||
placeholder={defaultShell}
|
||||
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}/>
|
||||
|
||||
<h2>Helm</h2>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user