From fedd5224cc2565eab4f3a08e2a9e6bd866391b27 Mon Sep 17 00:00:00 2001 From: Akos Vandra Date: Wed, 15 Jun 2016 16:47:59 +0200 Subject: [PATCH] add possibility to bump versions from the version input dialog --- src/main/scala/ReleaseExtra.scala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/scala/ReleaseExtra.scala b/src/main/scala/ReleaseExtra.scala index fa9a9d4..e78eb19 100644 --- a/src/main/scala/ReleaseExtra.scala +++ b/src/main/scala/ReleaseExtra.scala @@ -274,11 +274,15 @@ object ReleaseStateTransformations { def readVersion(ver: String, prompt: String, useDef: Boolean, commandLineVersion: Option[String]): String = { if (commandLineVersion.isDefined) commandLineVersion.get else if (useDef) ver - else SimpleReader.readLine(prompt format ver) match { - case Some("") => ver - case Some(input) => Version(input).map(_.string).getOrElse(versionFormatError) + else (SimpleReader.readLine(prompt format ver) match { + case Some("") => Version(ver) + case Some("M") => Version(ver).map(_.bump(Version.Bump.Major)) + case Some("m") => Version(ver).map(_.bump(Version.Bump.Minor)) + case Some("p") | Some("b") => Version(ver).map(_.bump(Version.Bump.Bugfix)) + case Some("n") => Version(ver).map(_.bump(Version.Bump.Nano)) + case Some(input) => Version(input) case None => sys.error("No version provided!") - } + }).map(_.string).getOrElse(versionFormatError) } def reapply(settings: Seq[Setting[_]], state: State): State = {