How to add custom console commands and handle them?

See also: