public void hookCommandLineListener(CommandLine cmdLine) throws Exception {
  List<CommandLineArgument[]> allCommandLineList=new ArrayList<>();
  Map<String,CommandLineListener> extMap=new HashMap<>();
  for (  Map.Entry<Extension,ExtensionHook> entry : extensionHooks.entrySet()) {
    ExtensionHook hook=entry.getValue();
    CommandLineArgument[] arg=hook.getCommandLineArgument();
    if (arg.length > 0) {
      allCommandLineList.add(arg);
    }
    Extension extension=entry.getKey();
    if (extension instanceof CommandLineListener) {
      CommandLineListener cli=(CommandLineListener)extension;
      List<String> exts=cli.getHandledExtensions();
      if (exts != null) {
        for (        String ext : exts) {
          extMap.put(ext,cli);
        }
      }
    }
  }
  cmdLine.parse(allCommandLineList,extMap);
}

public void hookCommandLineListener ( CommandLine cmdLine ) throws Exception { List < CommandLineArgument [ ] > allCommandLineList = new ArrayList < > ( ) ; Map < String , CommandLineListener > extMap = new HashMap < > ( ) ; for ( Map . Entry < Extension , ExtensionHook > entry : extensionHooks . entrySet ( ) ) { ExtensionHook hook = entry . getValue ( ) ; CommandLineArgument [ ] arg = hook . getCommandLineArgument ( ) ; if ( arg . length > 0 ) { allCommandLineList . add ( arg ) ; } Extension extension = entry . getKey ( ) ; if ( extension instanceof CommandLineListener ) { CommandLineListener cli = ( CommandLineListener ) extension ; List < String > exts = cli . getHandledExtensions ( ) ; if ( exts != null ) { for ( String ext : exts ) { extMap . put ( ext , cli ) ; } } } } cmdLine . parse ( allCommandLineList , extMap ) ; }
hook command line listener with the command line processor
