Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add possibility to bump versions from the version input dialog #162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/main/scala/ReleaseExtra.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down