GROOVY-6393 groovysh: restructure Main.groovy

- Do not install AnsiConsole in static initializer
- Allow subclassing

The code changes are not complex, but cannot be easily tested, so please review thoroughly. It is not pure refactoring, the logic of initializing ansi features has changed (for the better I hope).