From 395c7419835ca25e981791113bdcbc6bb5f32917 Mon Sep 17 00:00:00 2001 From: Andrii Bodnar Date: Thu, 1 Jun 2023 09:50:52 +0300 Subject: [PATCH] fix: plain view for --keep-archive option --- .../com/crowdin/cli/commands/actions/DownloadAction.java | 7 ++++++- .../cli/commands/actions/DownloadBundleAction.java | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java b/src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java index 68f8b7be4..452eec7d8 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java @@ -351,8 +351,13 @@ private Pair> download(BuildProjectTranslationRequest request out.println(ERROR.withIcon(String.format(RESOURCE_BUNDLE.getString("error.deleting_archive"), downloadedZipArchive))); } } else { - out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.archive"), downloadedZipArchivePath))); + if (!plainView) { + out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.archive"), downloadedZipArchivePath))); + } else { + out.println(downloadedZipArchivePath); + } } + return Pair.of(baseTempDir, downloadedFilesProc); } diff --git a/src/main/java/com/crowdin/cli/commands/actions/DownloadBundleAction.java b/src/main/java/com/crowdin/cli/commands/actions/DownloadBundleAction.java index a6c6f84bc..f7950f854 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/DownloadBundleAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/DownloadBundleAction.java @@ -55,10 +55,12 @@ public void act(Outputter out, ProjectProperties pb, ClientBundle client) { String baseTemp = StringUtils.removeEnd(pb.getBasePath(), Utils.PATH_SEPARATOR) + Utils.PATH_SEPARATOR; java.io.File baseTempDir = new java.io.File(baseTemp + Utils.PATH_SEPARATOR); List downloadedFiles = extractArchive(to, baseTempDir); + for (File file: downloadedFiles) { String filePath = Utils.noSepAtStart(StringUtils.removeStart(file.getAbsolutePath(), baseTempDir.getAbsolutePath())); out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.extracted_file"), filePath))); } + if (!keepArchive) { try { files.deleteFile(to); @@ -66,7 +68,11 @@ public void act(Outputter out, ProjectProperties pb, ClientBundle client) { out.println(ERROR.withIcon(String.format(RESOURCE_BUNDLE.getString("error.deleting_archive"), to))); } } else { - out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.archive"), to.getAbsolutePath()))); + if (!plainView) { + out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.archive"), to.getAbsolutePath()))); + } else { + out.println(to.getAbsolutePath()); + } } }