Force download option

This commit is contained in:
Alexandre Archambault 2015-07-04 15:19:43 +01:00
parent 77fc66aae8
commit 9ccf972f8a
1 changed files with 9 additions and 0 deletions

View File

@ -18,6 +18,7 @@ case class Coursier(
@ExtraName("D") javadoc: Boolean,
@ExtraName("P") @ExtraName("cp") classpath: Boolean,
@ExtraName("c") offline: Boolean,
@ExtraName("f") force: Boolean,
@ExtraName("v") verbose: List[Unit],
@ExtraName("N") maxIterations: Int = 100,
@ExtraName("r") repository: List[String],
@ -36,6 +37,12 @@ case class Coursier(
def println(s: String) = Console.err.println(s)
if (force && offline) {
println("Error: --offline (-c) and --force (-f) options can't be specified at the same time.")
sys.exit(255)
}
def defaultLogger: MavenRepository.Logger with Files.Logger =
new MavenRepository.Logger with Files.Logger {
def downloading(url: String) =
@ -85,6 +92,8 @@ case class Coursier(
implicit val cachePolicy =
if (offline)
CachePolicy.LocalOnly
else if (force)
CachePolicy.ForceDownload
else
CachePolicy.Default