@@ -397,7 +397,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
397
397
}
398
398
399
399
OptionParser configure = OptionParser .scan (parser -> {
400
- parser .on ("-R configPath" ).Do ( cfgFile -> {
400
+ parser .on ("-R configPath" ).Do (cfgFile -> {
401
401
try {
402
402
cfg = Configuration .read (new File ((String )cfgFile ));
403
403
} catch (IOException e ) {
@@ -413,7 +413,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
413
413
parser .setPrologue (
414
414
String .format ("\n Usage: java -jar %s [options] [subDir1 [...]]\n " , program ));
415
415
416
- parser .on ("-?" , "-h" , "--help" , "Display this usage summary." ).Do ( v -> {
416
+ parser .on ("-?" , "-h" , "--help" , "Display this usage summary." ).Do (v -> {
417
417
help = true ;
418
418
helpUsage = parser .getUsage ();
419
419
});
@@ -436,7 +436,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
436
436
" with \" BAR\" (no full-stop)" ,
437
437
" Ex: -A .c:-" ,
438
438
" will disable specialized analyzers for all files ending with .c" ).
439
- Do ( analyzerSpec -> {
439
+ Do (analyzerSpec -> {
440
440
String [] arg = ((String )analyzerSpec ).split (":" );
441
441
String fileSpec = arg [0 ];
442
442
String analyzer = arg [1 ];
@@ -447,13 +447,13 @@ public static String[] parseOptions(String[] argv) throws ParseException {
447
447
parser .on ("-c" , "--ctags" ,"=/path/to/ctags" ,
448
448
"Path to Exuberant or Universal Ctags" ,
449
449
"By default takes the Exuberant Ctags in PATH." ).
450
- Do ( ctagsPath -> {
450
+ Do (ctagsPath -> {
451
451
cfg .setCtags ((String )ctagsPath );
452
452
}
453
453
);
454
454
455
455
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 -> {
457
457
try {
458
458
File cfgFile = new File ((String )v );
459
459
checkIndexVersionCfg = Configuration .read (cfgFile );
@@ -464,7 +464,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
464
464
465
465
parser .on ("-d" , "--dataRoot" , "=/path/to/data/root" ,
466
466
"The directory where OpenGrok stores the generated data." ).
467
- Do ( drPath -> {
467
+ Do (drPath -> {
468
468
File dataRoot = new File ((String )drPath );
469
469
if (!dataRoot .exists () && !dataRoot .mkdirs ()) {
470
470
die ("Cannot create data root: " + dataRoot );
@@ -482,49 +482,49 @@ public static String[] parseOptions(String[] argv) throws ParseException {
482
482
483
483
parser .on ("--deleteHistory" , "=/path/to/repository" ,
484
484
"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 -> {
486
486
zapCache .add ((String )repo );
487
487
});
488
488
489
489
parser .on ("--depth" , "=number" , Integer .class ,
490
490
"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 -> {
492
492
cfg .setScanningDepth ((Integer )depth );
493
493
});
494
494
495
495
parser .on ("-e" , "--economical" ,
496
496
"Economical, consumes less disk space." ,
497
497
"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 -> {
499
499
cfg .setGenerateHtml (false );
500
500
});
501
501
502
502
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 -> {
504
504
cfg .setTagsEnabled (true );
505
505
});
506
506
507
- parser .on ("-H" , "--history" , "Enable history." ).Do ( v -> {
507
+ parser .on ("-H" , "--history" , "Enable history." ).Do (v -> {
508
508
cfg .setHistoryEnabled (true );
509
509
});
510
510
511
511
parser .on ("-I" , "--include" , "=pattern" ,
512
512
"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 -> {
514
514
cfg .getIncludedNames ().add ((String )pattern );
515
515
});
516
516
517
517
parser .on ("-i" , "--ignore" , "=pattern" ,
518
518
"Ignore the named files (prefixed with 'f:')" ,
519
519
"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 -> {
521
521
cfg .getIgnoredNames ().add ((String )pattern );
522
522
});
523
523
524
524
parser .on ("-l" , "--lock" , "=on|off|simple|native" , LUCENE_LOCKS ,
525
525
"Set OpenGrok/Lucene locking mode of the Lucene database" ,
526
526
"during index generation. \" on\" is an alias for \" simple\" ." ,
527
- "Default is off." ).Do ( v -> {
527
+ "Default is off." ).Do (v -> {
528
528
try {
529
529
if (v != null ) {
530
530
String vuc = v .toString ().toUpperCase (Locale .ROOT );
@@ -537,22 +537,22 @@ public static String[] parseOptions(String[] argv) throws ParseException {
537
537
});
538
538
539
539
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 -> {
541
541
cfg .setAllowLeadingWildcard ((Boolean )v );
542
542
});
543
543
544
- parser .on ("--listRepos" , "List all repository paths and exit." ).Do ( v -> {
544
+ parser .on ("--listRepos" , "List all repository paths and exit." ).Do (v -> {
545
545
listRepos = true ;
546
546
});
547
547
548
548
parser .on ("-m" , "--memory" , "=number" , Double .class ,
549
549
"Amount of memory that may be used for buffering added documents and" ,
550
550
"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 -> {
552
552
cfg .setRamBufferSize ((Double )memSize );
553
553
});
554
554
555
- parser .on ("--man" , "Generate OpenGrok XML manual page." ).Do ( v -> {
555
+ parser .on ("--man" , "Generate OpenGrok XML manual page." ).Do (v -> {
556
556
try {
557
557
System .out .print (parser .getManPage ());
558
558
} catch (IOException e ) {
@@ -570,14 +570,14 @@ public static String[] parseOptions(String[] argv) throws ParseException {
570
570
);
571
571
572
572
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 -> {
574
574
runIndex = false ;
575
575
});
576
576
577
577
parser .on ("-O" , "--optimize" , "=on|off" , ON_OFF , Boolean .class ,
578
578
"Turn on/off the optimization of the index database" ,
579
579
"as part of the indexing step." ).
580
- Do ( v -> {
580
+ Do (v -> {
581
581
boolean oldval = cfg .isOptimizeDatabase ();
582
582
cfg .setOptimizeDatabase ((Boolean )v );
583
583
if (oldval != cfg .isOptimizeDatabase ()) {
@@ -588,7 +588,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
588
588
589
589
parser .on ("-o" , "--ctagOpts" , "=path" ,
590
590
"File with extra command line options for ctags." ).
591
- Do ( path -> {
591
+ Do (path -> {
592
592
String CTagsExtraOptionsFile = (String )path ;
593
593
File CTagsFile = new File (CTagsExtraOptionsFile );
594
594
if (!(CTagsFile .isFile () && CTagsFile .canRead ())) {
@@ -601,7 +601,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
601
601
);
602
602
603
603
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 -> {
605
605
addProjects = true ;
606
606
cfg .setProjectsEnabled (true );
607
607
});
@@ -611,7 +611,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
611
611
"by default in the web application (when no other project" ,
612
612
"set either in cookie or in parameter). May be used multiple" ,
613
613
"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 -> {
615
615
defaultProjects .add ((String )v );
616
616
});
617
617
@@ -622,7 +622,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
622
622
"Print per project percentage progress information." ,
623
623
"(I/O extensive, since one read through directory structure is" ,
624
624
"made before indexing, needs -v, otherwise it just goes to the log)" ).
625
- Do ( v -> {
625
+ Do (v -> {
626
626
cfg .setPrintProgress (true );
627
627
}
628
628
);
@@ -631,23 +631,23 @@ public static String[] parseOptions(String[] argv) throws ParseException {
631
631
"Turn on/off quick context scan. By default, only the first" ,
632
632
"1024k of a file is scanned, and a '[..all..]' link is inserted" ,
633
633
"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 -> {
635
635
cfg .setQuickContextScan ((Boolean )v );
636
636
});
637
637
638
638
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 -> {
640
640
LoggerUtil .setBaseConsoleLogLevel (Level .WARNING );
641
641
});
642
642
643
643
parser .on ("--repository" , "=repository" ,
644
644
"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 -> {
646
646
repositories .add ((String )repo );
647
647
});
648
648
649
649
parser .on ("-R /path/to/configuration" ,
650
- "Read configuration from the specified file." ).Do ( v -> {
650
+ "Read configuration from the specified file." ).Do (v -> {
651
651
// Already handled above. This populates usage.
652
652
});
653
653
@@ -659,7 +659,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
659
659
" uionly - support remote SCM for user interface only." ,
660
660
"dirbased - allow retrieval during history index only for repositories" ,
661
661
" which allow getting history for directories." ).
662
- Do ( v -> {
662
+ Do (v -> {
663
663
String option = (String ) v ;
664
664
if (option .equalsIgnoreCase (ON )) {
665
665
cfg .setRemoteScmSupported (Configuration .RemoteSCM .ON );
@@ -676,18 +676,18 @@ public static String[] parseOptions(String[] argv) throws ParseException {
676
676
parser .on ("--renamedHistory" , "=on|off" , ON_OFF , Boolean .class ,
677
677
"Enable or disable generating history for renamed files." ,
678
678
"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 -> {
680
680
cfg .setHandleHistoryOfRenamedFiles ((Boolean )v );
681
681
});
682
682
683
683
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 -> {
685
685
searchRepositories = true ;
686
686
});
687
687
688
688
parser .on ("-s" , "--source" , "=/path/to/source/root" ,
689
689
"The root directory of the source tree." ).
690
- Do ( source -> {
690
+ Do (source -> {
691
691
File sourceRoot = new File ((String )source );
692
692
if (!sourceRoot .isDirectory ()) {
693
693
die ("Source root " + sourceRoot + " must be a directory" );
@@ -703,27 +703,27 @@ public static String[] parseOptions(String[] argv) throws ParseException {
703
703
parser .on ("--style" , "=path" ,
704
704
"Path to the subdirectory in the web-application containing the" ,
705
705
"requested stylesheet. The factory-setting is: \" default\" ." ).
706
- Do ( stylePath -> {
706
+ Do (stylePath -> {
707
707
cfg .setWebappLAF ((String )stylePath );
708
708
}
709
709
);
710
710
711
711
parser .on ("--symlink" , "=/path/to/symlink" ,
712
712
"Allow this symlink to be followed. Option may be repeated." ,
713
713
"By default only symlinks directly under source root directory" ,
714
- "are allowed." ).Do ( symlink -> {
714
+ "are allowed." ).Do (symlink -> {
715
715
allowedSymlinks .add ((String )symlink );
716
716
});
717
717
718
718
parser .on ("-T" , "--threads" , "=number" , Integer .class ,
719
719
"The number of threads to use for index generation." ,
720
720
"By default the number of threads will be set to the number" ,
721
- "of available CPUs." ).Do ( threadCount -> {
721
+ "of available CPUs." ).Do (threadCount -> {
722
722
cfg .setIndexingParallelism ((Integer )threadCount );
723
723
});
724
724
725
725
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 -> {
727
727
cfg .setTabSize ((Integer )tabSize );
728
728
});
729
729
@@ -739,35 +739,35 @@ public static String[] parseOptions(String[] argv) throws ParseException {
739
739
parser .on ("---unitTest" ); // For unit test only, will not appear in help
740
740
741
741
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 -> {
743
743
noindex = true ;
744
744
});
745
745
746
746
parser .on ("--userPage" , "=URL" ,
747
747
"Base URL of the user Information provider." ,
748
748
"Example: \" http://www.myserver.org/viewProfile.jspa?username=\" ." ,
749
- "Use \" none\" to disable link." ).Do ( v -> {
749
+ "Use \" none\" to disable link." ).Do (v -> {
750
750
cfg .setUserPage ((String )v );
751
751
});
752
752
753
753
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 -> {
755
755
cfg .setUserPageSuffix ((String )suffix );
756
756
});
757
757
758
- parser .on ("-V" , "--version" , "Print version and quit." ).Do ( v -> {
758
+ parser .on ("-V" , "--version" , "Print version and quit." ).Do (v -> {
759
759
System .out .println (Info .getFullVersion ());
760
760
System .exit (0 );
761
761
});
762
762
763
- parser .on ("-v" , "--verbose" , "Set logging level to INFO." ).Do ( v -> {
763
+ parser .on ("-v" , "--verbose" , "Set logging level to INFO." ).Do (v -> {
764
764
verbose = true ;
765
765
LoggerUtil .setBaseConsoleLogLevel (Level .INFO );
766
766
});
767
767
768
768
parser .on ("-W" , "--writeConfig" , "=/path/to/configuration" ,
769
769
"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 -> {
771
771
configFilename = (String )configFile ;
772
772
});
773
773
});
0 commit comments