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