/**
 * Manages the history of previously executed commands.
 */ export class History { private entries : string [ ] = [ ] ; add ( cmd ) { cmd = cmd . trim ( ) ; if ( cmd === '' ) return ; if ( this . entries . length > 0 && this . get ( 1 ) === cmd ) return ; this . entries . push ( cmd ) ; } get ( ofs ) { if ( ofs > this . entries . length ) return ; return this . entries [ this . entries . length - ofs ] ; } }