import { Arguments , RawResponse , Registrar } from '@kui-shell/core' ; export async function mkTemp ( ) { const { file : tmpFile } = await import ( 'tmp' ) ; return new Promise ( ( resolve , reject ) => { tmpFile ( { prefix : 'kui-' } , ( err , tmp ) => { if ( err ) { reject ( err ) ; } else { resolve ( { mode : 'raw' , content : tmp } ) ; } } ) ; } ) ; } async function rmTemp ( args ) { const { unlink } = await import ( 'fs' ) ; return new Promise ( ( resolve , reject ) => { unlink ( args . argvNoOptions [ 1 ] , err => { if ( err ) { reject ( err ) ; } else { resolve ( true ) ; } } ) ; } ) ; } /**
 * Register command handlers
 *
 */ export default ( registrar ) => { registrar . listen ( '/mkTemp' , mkTemp , { hidden : true , requiresLocal : true } ) ; registrar . listen ( '/rmTemp' , rmTemp , { hidden : true , requiresLocal : true } ) ; } ;