import { Arguments , Registrar } from '@kui-shell/core' ; import { doHelp , preprocessTable , formatTable , KubeOptions } from '@kui-shell/plugin-kubectl' ; import isUsage from './usage' ; import doExecWithStdout from './exec' ; async function doSearch ( args ) { if ( isUsage ( args , 'search' ) ) { return doHelp ( 'helm' , args ) ; } const response = await doExecWithStdout ( args ) ; const preTables = preprocessTable ( response . split ( /^(?=LAST SEEN|NAMESPACE|NAME\s+)/m ) ) ; return formatTable ( 'helm' , undefined , undefined , args , preTables [ 0 ] ) ; } export default ( registrar ) => { registrar . listen ( '/helm/search' , doSearch ) ; } ;