diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-02-26 21:45:32 +0800 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-02-27 12:27:44 +0800 |
commit | 92e17f18965dce6ca10b00928dbae28a0ad38617 (patch) | |
tree | ec28a05f4f035db757eedbdc91e110cfba2e9687 /stage1 | |
parent | 9b9292e809352aabe908bc62a8aa38645eabc203 (diff) | |
download | cbt-92e17f18965dce6ca10b00928dbae28a0ad38617.tar.gz cbt-92e17f18965dce6ca10b00928dbae28a0ad38617.tar.bz2 cbt-92e17f18965dce6ca10b00928dbae28a0ad38617.zip |
sh-like exit code combination operators
Diffstat (limited to 'stage1')
-rw-r--r-- | stage1/Stage1Lib.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/stage1/Stage1Lib.scala b/stage1/Stage1Lib.scala index c42ee12..aa7b497 100644 --- a/stage1/Stage1Lib.scala +++ b/stage1/Stage1Lib.scala @@ -12,7 +12,10 @@ import java.util.{Set=>_,Map=>_,List=>_,_} import javax.xml.bind.annotation.adapters.HexBinaryAdapter // CLI interop -case class ExitCode(integer: Int) +case class ExitCode(integer: Int){ + def ||( other: => ExitCode ) = if( this == ExitCode.Success ) this else other + def &&( other: => ExitCode ) = if( this != ExitCode.Success ) this else other +} object ExitCode{ val Success = ExitCode(0) val Failure = ExitCode(1) |