Skip to content

Commit e93aeb4

Browse files
author
Vladimir Kotal
committed
fix Do() w.r.t. coding style
1 parent 1ce56ca commit e93aeb4

File tree

1 file changed

+42
-42
lines changed
  • opengrok-indexer/src/main/java/org/opengrok/indexer/index

1 file changed

+42
-42
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/index/Indexer.java

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
397397
}
398398

399399
OptionParser configure = OptionParser.scan(parser -> {
400-
parser.on("-R configPath").Do( cfgFile -> {
400+
parser.on("-R configPath").Do(cfgFile -> {
401401
try {
402402
cfg = Configuration.read(new File((String)cfgFile));
403403
} catch(IOException e) {
@@ -413,7 +413,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
413413
parser.setPrologue(
414414
String.format("\nUsage: java -jar %s [options] [subDir1 [...]]\n", program));
415415

416-
parser.on("-?", "-h", "--help", "Display this usage summary.").Do( v -> {
416+
parser.on("-?", "-h", "--help", "Display this usage summary.").Do(v -> {
417417
help = true;
418418
helpUsage = parser.getUsage();
419419
});
@@ -436,7 +436,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
436436
" with \"BAR\" (no full-stop)",
437437
" Ex: -A .c:-",
438438
" will disable specialized analyzers for all files ending with .c").
439-
Do( analyzerSpec -> {
439+
Do(analyzerSpec -> {
440440
String[] arg = ((String)analyzerSpec).split(":");
441441
String fileSpec = arg[0];
442442
String analyzer = arg[1];
@@ -447,13 +447,13 @@ public static String[] parseOptions(String[] argv) throws ParseException {
447447
parser.on("-c", "--ctags","=/path/to/ctags",
448448
"Path to Exuberant or Universal Ctags",
449449
"By default takes the Exuberant Ctags in PATH.").
450-
Do( ctagsPath -> {
450+
Do(ctagsPath -> {
451451
cfg.setCtags((String)ctagsPath);
452452
}
453453
);
454454

455455
parser.on("--checkIndexVersion", "=/path/to/conf",
456-
"Check if current Lucene version matches index version").Do( v -> {
456+
"Check if current Lucene version matches index version").Do(v -> {
457457
try {
458458
File cfgFile = new File((String)v);
459459
checkIndexVersionCfg = Configuration.read(cfgFile);
@@ -464,7 +464,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
464464

465465
parser.on("-d", "--dataRoot", "=/path/to/data/root",
466466
"The directory where OpenGrok stores the generated data.").
467-
Do( drPath -> {
467+
Do(drPath -> {
468468
File dataRoot = new File((String)drPath);
469469
if (!dataRoot.exists() && !dataRoot.mkdirs()) {
470470
die("Cannot create data root: " + dataRoot);
@@ -482,49 +482,49 @@ public static String[] parseOptions(String[] argv) throws ParseException {
482482

483483
parser.on("--deleteHistory", "=/path/to/repository",
484484
"Delete the history cache for the given repository and exit.",
485-
"Use '*' to delete the cache for all repositories.").Do( repo -> {
485+
"Use '*' to delete the cache for all repositories.").Do(repo -> {
486486
zapCache.add((String)repo);
487487
});
488488

489489
parser.on("--depth", "=number", Integer.class,
490490
"Scanning depth for repositories in directory structure relative to",
491-
"source root. Default is " + Configuration.defaultScanningDepth + ".").Do( depth -> {
491+
"source root. Default is " + Configuration.defaultScanningDepth + ".").Do(depth -> {
492492
cfg.setScanningDepth((Integer)depth);
493493
});
494494

495495
parser.on("-e", "--economical",
496496
"Economical, consumes less disk space.",
497497
"It does not generate hyper text cross reference files offline,",
498-
"but will do so on demand, which could be sightly slow.").Do( v -> {
498+
"but will do so on demand, which could be sightly slow.").Do(v -> {
499499
cfg.setGenerateHtml(false);
500500
});
501501

502502
parser.on("-G", "--assignTags",
503-
"Assign commit tags to all entries in history for all repositories.").Do( v -> {
503+
"Assign commit tags to all entries in history for all repositories.").Do(v -> {
504504
cfg.setTagsEnabled(true);
505505
});
506506

507-
parser.on("-H", "--history", "Enable history.").Do( v -> {
507+
parser.on("-H", "--history", "Enable history.").Do(v -> {
508508
cfg.setHistoryEnabled(true);
509509
});
510510

511511
parser.on("-I", "--include", "=pattern",
512512
"Only files matching this pattern will be examined.",
513-
"(supports wildcards, example: -I *.java -I *.c)").Do( pattern -> {
513+
"(supports wildcards, example: -I *.java -I *.c)").Do(pattern -> {
514514
cfg.getIncludedNames().add((String)pattern);
515515
});
516516

517517
parser.on("-i", "--ignore", "=pattern",
518518
"Ignore the named files (prefixed with 'f:')",
519519
"or directories (prefixed with 'd:').",
520-
"Supports wildcards (example: -i *.so -i *.dll)").Do( pattern -> {
520+
"Supports wildcards (example: -i *.so -i *.dll)").Do(pattern -> {
521521
cfg.getIgnoredNames().add((String)pattern);
522522
});
523523

524524
parser.on("-l", "--lock", "=on|off|simple|native", LUCENE_LOCKS,
525525
"Set OpenGrok/Lucene locking mode of the Lucene database",
526526
"during index generation. \"on\" is an alias for \"simple\".",
527-
"Default is off.").Do( v -> {
527+
"Default is off.").Do(v -> {
528528
try {
529529
if (v != null) {
530530
String vuc = v.toString().toUpperCase(Locale.ROOT);
@@ -537,22 +537,22 @@ public static String[] parseOptions(String[] argv) throws ParseException {
537537
});
538538

539539
parser.on("--leadingWildCards", "=on|off", ON_OFF, Boolean.class,
540-
"Allow or disallow leading wildcards in a search.").Do( v -> {
540+
"Allow or disallow leading wildcards in a search.").Do(v -> {
541541
cfg.setAllowLeadingWildcard((Boolean)v);
542542
});
543543

544-
parser.on("--listRepos", "List all repository paths and exit.").Do( v -> {
544+
parser.on("--listRepos", "List all repository paths and exit.").Do(v -> {
545545
listRepos = true;
546546
});
547547

548548
parser.on("-m", "--memory", "=number", Double.class,
549549
"Amount of memory that may be used for buffering added documents and",
550550
"deletions before they are flushed to the directory (default "+Configuration.defaultRamBufferSize+"MB).",
551-
"Please increase JVM heap accordingly, too.").Do( memSize -> {
551+
"Please increase JVM heap accordingly, too.").Do(memSize -> {
552552
cfg.setRamBufferSize((Double)memSize);
553553
});
554554

555-
parser.on("--man", "Generate OpenGrok XML manual page.").Do( v -> {
555+
parser.on("--man", "Generate OpenGrok XML manual page.").Do(v -> {
556556
try {
557557
System.out.print(parser.getManPage());
558558
} catch(IOException e) {
@@ -570,14 +570,14 @@ public static String[] parseOptions(String[] argv) throws ParseException {
570570
);
571571

572572
parser.on("-n", "--noIndex",
573-
"Do not generate indexes, but process all other command line options.").Do( v -> {
573+
"Do not generate indexes, but process all other command line options.").Do(v -> {
574574
runIndex = false;
575575
});
576576

577577
parser.on("-O", "--optimize", "=on|off", ON_OFF, Boolean.class,
578578
"Turn on/off the optimization of the index database",
579579
"as part of the indexing step.").
580-
Do( v -> {
580+
Do(v -> {
581581
boolean oldval = cfg.isOptimizeDatabase();
582582
cfg.setOptimizeDatabase((Boolean)v);
583583
if (oldval != cfg.isOptimizeDatabase()) {
@@ -588,7 +588,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
588588

589589
parser.on("-o", "--ctagOpts", "=path",
590590
"File with extra command line options for ctags.").
591-
Do( path -> {
591+
Do(path -> {
592592
String CTagsExtraOptionsFile = (String)path;
593593
File CTagsFile = new File(CTagsExtraOptionsFile);
594594
if (!(CTagsFile.isFile() && CTagsFile.canRead())) {
@@ -601,7 +601,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
601601
);
602602

603603
parser.on("-P", "--projects",
604-
"Generate a project for each top-level directory in source root.").Do( v -> {
604+
"Generate a project for each top-level directory in source root.").Do(v -> {
605605
addProjects = true;
606606
cfg.setProjectsEnabled(true);
607607
});
@@ -611,7 +611,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
611611
"by default in the web application (when no other project",
612612
"set either in cookie or in parameter). May be used multiple",
613613
"times for several projects. Use \"__all__\" for all projects.",
614-
"You should strip off the source root.").Do( v -> {
614+
"You should strip off the source root.").Do(v -> {
615615
defaultProjects.add((String)v);
616616
});
617617

@@ -622,7 +622,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
622622
"Print per project percentage progress information.",
623623
"(I/O extensive, since one read through directory structure is",
624624
"made before indexing, needs -v, otherwise it just goes to the log)").
625-
Do( v -> {
625+
Do(v -> {
626626
cfg.setPrintProgress(true);
627627
}
628628
);
@@ -631,23 +631,23 @@ public static String[] parseOptions(String[] argv) throws ParseException {
631631
"Turn on/off quick context scan. By default, only the first",
632632
"1024k of a file is scanned, and a '[..all..]' link is inserted",
633633
"when the file is bigger. Activating this may slow the server down.",
634-
"(Note: this is setting only affects the web application)").Do( v -> {
634+
"(Note: this is setting only affects the web application)").Do(v -> {
635635
cfg.setQuickContextScan((Boolean)v);
636636
});
637637

638638
parser.on("-q", "--quiet", "Run as quietly as possible.",
639-
"Sets logging level to WARNING.").Do( v -> {
639+
"Sets logging level to WARNING.").Do(v -> {
640640
LoggerUtil.setBaseConsoleLogLevel(Level.WARNING);
641641
});
642642

643643
parser.on("--repository", "=repository",
644644
"Generate history for specific repository specified as relative path to source root. ",
645-
"Can be used multiple times. Assumes history is on.").Do( repo -> {
645+
"Can be used multiple times. Assumes history is on.").Do(repo -> {
646646
repositories.add((String)repo);
647647
});
648648

649649
parser.on("-R /path/to/configuration",
650-
"Read configuration from the specified file.").Do( v-> {
650+
"Read configuration from the specified file.").Do(v-> {
651651
// Already handled above. This populates usage.
652652
});
653653

@@ -659,7 +659,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
659659
" uionly - support remote SCM for user interface only.",
660660
"dirbased - allow retrieval during history index only for repositories",
661661
" which allow getting history for directories.").
662-
Do( v -> {
662+
Do(v -> {
663663
String option = (String) v;
664664
if (option.equalsIgnoreCase(ON)) {
665665
cfg.setRemoteScmSupported(Configuration.RemoteSCM.ON);
@@ -676,18 +676,18 @@ public static String[] parseOptions(String[] argv) throws ParseException {
676676
parser.on("--renamedHistory", "=on|off", ON_OFF, Boolean.class,
677677
"Enable or disable generating history for renamed files.",
678678
"If set to on, makes history indexing slower for repositories",
679-
"with lots of renamed files.").Do( v -> {
679+
"with lots of renamed files.").Do(v -> {
680680
cfg.setHandleHistoryOfRenamedFiles((Boolean)v);
681681
});
682682

683683
parser.on("-S", "--search",
684-
"Search for \"external\" source repositories and add them.").Do( v -> {
684+
"Search for \"external\" source repositories and add them.").Do(v -> {
685685
searchRepositories = true;
686686
});
687687

688688
parser.on("-s", "--source", "=/path/to/source/root",
689689
"The root directory of the source tree.").
690-
Do( source -> {
690+
Do(source -> {
691691
File sourceRoot = new File((String)source);
692692
if (!sourceRoot.isDirectory()) {
693693
die("Source root " + sourceRoot + " must be a directory");
@@ -703,27 +703,27 @@ public static String[] parseOptions(String[] argv) throws ParseException {
703703
parser.on("--style", "=path",
704704
"Path to the subdirectory in the web-application containing the",
705705
"requested stylesheet. The factory-setting is: \"default\".").
706-
Do( stylePath -> {
706+
Do(stylePath -> {
707707
cfg.setWebappLAF((String)stylePath);
708708
}
709709
);
710710

711711
parser.on("--symlink", "=/path/to/symlink",
712712
"Allow this symlink to be followed. Option may be repeated.",
713713
"By default only symlinks directly under source root directory",
714-
"are allowed.").Do( symlink -> {
714+
"are allowed.").Do(symlink -> {
715715
allowedSymlinks.add((String)symlink);
716716
});
717717

718718
parser.on("-T", "--threads", "=number", Integer.class,
719719
"The number of threads to use for index generation.",
720720
"By default the number of threads will be set to the number",
721-
"of available CPUs.").Do( threadCount -> {
721+
"of available CPUs.").Do(threadCount -> {
722722
cfg.setIndexingParallelism((Integer)threadCount);
723723
});
724724

725725
parser.on("-t", "--tabSize", "=number", Integer.class,
726-
"Default tab size to use (number of spaces per tab character).").Do( tabSize -> {
726+
"Default tab size to use (number of spaces per tab character).").Do(tabSize -> {
727727
cfg.setTabSize((Integer)tabSize);
728728
});
729729

@@ -739,35 +739,35 @@ public static String[] parseOptions(String[] argv) throws ParseException {
739739
parser.on("---unitTest"); // For unit test only, will not appear in help
740740

741741
parser.on("--updateConfig",
742-
"Populate the webapp with bare configuration and exit.").Do( v -> {
742+
"Populate the webapp with bare configuration and exit.").Do(v -> {
743743
noindex = true;
744744
});
745745

746746
parser.on("--userPage", "=URL",
747747
"Base URL of the user Information provider.",
748748
"Example: \"http://www.myserver.org/viewProfile.jspa?username=\".",
749-
"Use \"none\" to disable link.").Do( v -> {
749+
"Use \"none\" to disable link.").Do(v -> {
750750
cfg.setUserPage((String)v);
751751
});
752752

753753
parser.on("--userPageSuffix", "=URL-suffix",
754-
"URL Suffix for the user Information provider. Default: \"\".").Do( suffix -> {
754+
"URL Suffix for the user Information provider. Default: \"\".").Do(suffix -> {
755755
cfg.setUserPageSuffix((String)suffix);
756756
});
757757

758-
parser.on("-V", "--version", "Print version and quit.").Do( v -> {
758+
parser.on("-V", "--version", "Print version and quit.").Do(v -> {
759759
System.out.println(Info.getFullVersion());
760760
System.exit(0);
761761
});
762762

763-
parser.on("-v", "--verbose", "Set logging level to INFO.").Do( v -> {
763+
parser.on("-v", "--verbose", "Set logging level to INFO.").Do(v -> {
764764
verbose = true;
765765
LoggerUtil.setBaseConsoleLogLevel(Level.INFO);
766766
});
767767

768768
parser.on("-W", "--writeConfig", "=/path/to/configuration",
769769
"Write the current configuration to the specified file",
770-
"(so that the web application can use the same configuration)").Do( configFile -> {
770+
"(so that the web application can use the same configuration)").Do(configFile -> {
771771
configFilename = (String)configFile;
772772
});
773773
});

0 commit comments

Comments
 (0)