diff --git a/webview/src/ConfigEditor/fields.tsx b/webview/src/ConfigEditor/fields.tsx index 445aa63..d8ed825 100644 --- a/webview/src/ConfigEditor/fields.tsx +++ b/webview/src/ConfigEditor/fields.tsx @@ -108,8 +108,32 @@ export function passphrase(config: FileSystemConfig, onChange: FSCChanged<'passp return } +export function sftpCommand(config: FileSystemConfig, onChange: FSCChanged<'sftpCommand'>): React.ReactElement { + const callback = (newValue?: string) => onChange('sftpCommand', newValue); + const description = 'A command to run on the remote SSH session to start a SFTP session (defaults to sftp subsystem)'; + return +} + +export function sftpSudo(config: FileSystemConfig, onChange: FSCChanged<'sftpSudo'>): React.ReactElement { + const callback = (newValue?: string) => onChange('sftpSudo', newValue === '' ? true : newValue); + const description = 'Whether to use a sudo shell (and for which user) to run the sftpCommand in (if present, gets passed as -u to sudo)'; + const values = ['']; + const value = (config.sftpSudo && typeof config.sftpSudo === 'string') ? config.sftpSudo : ''; + return +} + +export function terminalCommand(config: FileSystemConfig, onChange: FSCChanged<'terminalCommand'>): React.ReactElement { + const callback = (newValue?: string) => onChange('terminalCommand', (!newValue || newValue === '$SHELL') ? undefined : newValue); + const description = 'The command(s) to run when a new SSH terminals gets created. Defaults to `$SHELL`. Internally the command `cd ...` is run first'; + const values = ['$SHELL', '/usr/bin/bash', '/usr/bin/sh']; + let value = config.terminalCommand === '$SHELL' ? '' : config.terminalCommand || ''; + if (Array.isArray(value)) value = value.join('; '); + return +} + export type FieldFactory = (config: FileSystemConfig, onChange: FSCChanged, onChangeMultiple: FSCChangedMultiple) => React.ReactElement | null; export const FIELDS: FieldFactory[] = [ name, merge, label, group, putty, host, port, root, agent, username, password, privateKeyPath, passphrase, + sftpCommand, sftpSudo, terminalCommand, PROXY_FIELD];