code: public static void commandLineCompile(String[] args, boolean lookupUnnamedFiles) throws Exception {
          Options options = createCompilationOptions();
  
          CommandLineParser cliParser = new GroovyInternalPosixParser();
  
          CommandLine cli;
          cli = cliParser.parse(options, args);
  
          if (cli.hasOption('h')) {
              displayHelp(options);
              return;
          }
  
          if (cli.hasOption('v')) {
              displayVersion();
              return;
          }
  
          displayStackTraceOnError = cli.hasOption('e');
  
          CompilerConfiguration configuration = generateCompilerConfigurationFromOptions(cli);
  
          //
          // Load the file name list
          String[] filenames = generateFileNamesFromOptions(cli);
          boolean fileNameErrors = filenames == null;
          if (!fileNameErrors && (filenames.length == 0)) {
              displayHelp(options);
              return;
          }
  
          fileNameErrors = fileNameErrors && !validateFiles(filenames);
  
          if (!fileNameErrors) {
              doCompilation(configuration, null, filenames, lookupUnnamedFiles);
          }
      }
docs: Same as main(args) except that exceptions are thrown out instead of causing
  the VM to exit and the lookup for .groovy files can be controlled