-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1114 from pasieronen/cli-exit-code
Add --failure-level command line option to force non-zero exit code (fixes #1113)
- Loading branch information
Showing
6 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/cli/MaxSeverityLogHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.asciidoctor.jruby.cli; | ||
|
||
import org.asciidoctor.log.LogHandler; | ||
import org.asciidoctor.log.LogRecord; | ||
import org.asciidoctor.log.Severity; | ||
|
||
public class MaxSeverityLogHandler implements LogHandler { | ||
private Severity maxSeverity = Severity.DEBUG; | ||
|
||
@Override | ||
public void log(LogRecord logRecord) { | ||
if (this.maxSeverity.compareTo(logRecord.getSeverity()) < 0) { | ||
this.maxSeverity = logRecord.getSeverity(); | ||
} | ||
} | ||
|
||
public Severity getMaxSeverity() { | ||
return this.maxSeverity; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/cli/SeverityConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.asciidoctor.jruby.cli; | ||
|
||
import com.beust.jcommander.converters.EnumConverter; | ||
import org.asciidoctor.log.Severity; | ||
|
||
public class SeverityConverter extends EnumConverter<Severity> { | ||
|
||
public SeverityConverter() { | ||
super("--failure-level", Severity.class); | ||
} | ||
|
||
@Override | ||
public Severity convert(String argument) { | ||
return super.convert(argument.toUpperCase()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters