@@ -24,7 +24,6 @@ import org.joda.time.DateTime
2424import org .joda .time .format .DateTimeFormat
2525import spray .json ._
2626
27- import de .upb .cs .swt .delphi .cli .artifacts .SearchResultJson .searchResultFormat
2827import de .upb .cs .swt .delphi .cli .artifacts .StorageMetadataJson .queryStorageMetadataFormat
2928
3029class FileOutput (serverVersion : String = " UNKNOWN" )(implicit config: Config , backend : SttpBackend [Id , Nothing ]){
@@ -41,22 +40,29 @@ class FileOutput (serverVersion: String = "UNKNOWN")(implicit config:Config, ba
4140 writer.close()
4241
4342 val outputMode = config.outputMode.getOrElse(OutputMode .PomOnly )
43+ var progressCnt = 0f
4444
4545 info()
4646 info(f " Output Mode is ${outputMode.toString}, destination is ${folderPath.toString}" )
47+ info()
48+ print(" Downloading files: 00 %" )
4749
4850 results
4951 .map(r => r.toMavenRelativeUrl() + s " / ${r.metadata.artifactId}- ${r.metadata.version}" )
5052 .map(relUrl => " https://repo1.maven.org/maven2/" + relUrl).foreach( urlWithoutExtension => {
5153
54+ print(" \b\b\b\b " )
55+ val progressValue = (100f * progressCnt ).toInt / results.size
56+ print(s " ${if (progressValue < 10 ) f " 0 $progressValue" else progressValue} % " )
57+ progressCnt += 1
58+
5259 var artifactsToRetrieve = Seq [String ]()
5360 if (outputMode == OutputMode .PomOnly || outputMode == OutputMode .All ){
5461 artifactsToRetrieve = artifactsToRetrieve ++ Seq (s " $urlWithoutExtension.pom " )
5562 }
5663 if (outputMode == OutputMode .JarOnly || outputMode == OutputMode .All ){
5764 artifactsToRetrieve = artifactsToRetrieve ++ Seq (s " $urlWithoutExtension.jar " )
5865 }
59-
6066 artifactsToRetrieve.foreach( url => {
6167 sttp.get(uri " $url" ).response(asByteArray).send().body match {
6268 case Right (value) =>
@@ -66,9 +72,10 @@ class FileOutput (serverVersion: String = "UNKNOWN")(implicit config:Config, ba
6672 error(f " Failed to download artifact from $url, got: $value" )
6773 }
6874 })
69-
7075 })
71-
76+ print(" \b\b\b\b 100 %" )
77+ info()
78+ info()
7279 info(f " Successfully wrote results to $folderPath. " )
7380 }
7481
0 commit comments