import { InitialOptions } from "./cli" ; import { detectTerminalApp } from "./utils" ; export type Options = { env : NodeJS . ProcessEnv ; cwd : string ; cd : string ; split : boolean ; splitDirection : "vertically" | "horizontally" ; terminalApp : string | undefined ; } ; const defaultOptions = { env : process . env , cwd : process . cwd ( ) , cd : process . cwd ( ) , split : false , splitDirection : "vertically" , terminalApp : detectTerminalApp ( ) } ; function removeUndefinedValues ( obj ) { for ( const key in obj ) { if ( obj [ key ] === undefined ) { delete obj [ key ] ; } } return obj ; } export default ( initialOptions ) : Options => { const options = { ... defaultOptions , ... removeUndefinedValues ( initialOptions ) , env : { ... defaultOptions . env , ... initialOptions . env } } ; return options as Options ; } ;