[cli] replace history implementation with dynamic buffers instead of one big history buffer