hoaproject / Console

The Hoa\Console library.
https://hoa-project.net/
366 stars 32 forks source link

unset Autocompleter #69

Closed 1e1 closed 8 years ago

1e1 commented 8 years ago

We can't unset an autocompleter.

If I do $rl->setAutocompleter(null);, I obtain:

Fatal error: Uncaught TypeError: Argument 1 passed to Hoa\Console\Readline\Readline::setAutocompleter() must implement interface Hoa\Console\Readline\Autocompleter\Autocompleter, null given

Can you add the unsetAutocompleter() method?

Hywan commented 8 years ago

Yup, you cannot.

Hywan commented 8 years ago

You can use the aggregate autocompleter, namely Hoa\Console\Readline\Autocompleter\Aggregate. It wraps the collection of autocompleters inside an ArrayObject. With the getAutocompleters method, you can set add or remove autocompleters on-the-fly.