Dynamically disable n98-magerun commands

In some cases you like to disable your commands i.e if you are running n98-magerun on a production machine or if it doesn’t support the entire operating system.
The symfony command component have a simple solution for that. All commands are extended from the symfony command base class Symfony\Component\Console\Command which defines the method
isEnabled for that. The method must return a boolean value.

If you want to disable a command for older n98-magerun versions (interesting for module developers)
you can do it like this:

If you want to disable a command for a operating system you can use a utility class which is available inside of n98-magerun (We will provide a additional post for the utility classes in the future).

Or the hostname (here hardcoded):

You can see it’s pretty simple to disable a command.

Happy coding!