From 66498b53dbb8d22470e66eaa0c2b63971ad02466 Mon Sep 17 00:00:00 2001 From: Yevheniy Oliynyk Date: Thu, 16 May 2024 13:12:08 +0200 Subject: [PATCH] feat: quite option for init command --- src/main/java/com/crowdin/cli/BaseCli.java | 28 ++----------------- .../cli/commands/picocli/InitSubcommand.java | 2 +- .../resources/messages/messages.properties | 1 + website/blog/2024-05-28-cli-v4/index.md | 2 ++ 4 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/crowdin/cli/BaseCli.java b/src/main/java/com/crowdin/cli/BaseCli.java index b7b1d5ae..619240a6 100644 --- a/src/main/java/com/crowdin/cli/BaseCli.java +++ b/src/main/java/com/crowdin/cli/BaseCli.java @@ -2,11 +2,7 @@ import com.crowdin.cli.utils.Utils; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.ResourceBundle; /** @@ -14,34 +10,14 @@ */ public class BaseCli { - public static final List DEFAULT_CONFIGS = Collections.unmodifiableList(Arrays.asList("crowdin.yml", "crowdin.yaml")); + public static final List DEFAULT_CONFIGS = List.of("crowdin.yml", "crowdin.yaml"); public static final String DEFAULT_GLOSSARY_NAME = "Created in Crowdin CLI (%s)"; public static final String DEFAULT_TM_NAME = "Created in Crowdin CLI (%s)"; public static final String ALL = "ALL"; - public static final List DEFAULT_IDENTITY_FILES = Collections.unmodifiableList(Arrays.asList( - System.getProperty("user.home") + Utils.PATH_SEPARATOR + ".crowdin.yml", - System.getProperty("user.home") + Utils.PATH_SEPARATOR + ".crowdin.yaml" - )); - - /** - * File format -> Export File Format (see https://support.crowdin.com/api/v2/#operation/api.projects.translations.exports.post) - */ - public static final Map FILE_FORMAT_MAPPER = Collections.unmodifiableMap(new HashMap() {{ - put("xliff", "xliff"); - put("xml", "android"); - put("strings", "macosx"); - put("yml", "yaml-export"); - put("resx", "crowdin-resx"); - put("csv", "crowdin-csv"); - put("properties", "crowdin-properties"); - put("arb", "arb-export"); - put("stringsdict", "stringsdict-export"); - put("po", "po-export"); - }} - ); + public static final List DEFAULT_IDENTITY_FILES = List.of(System.getProperty("user.home") + Utils.PATH_SEPARATOR + ".crowdin.yml", System.getProperty("user.home") + Utils.PATH_SEPARATOR + ".crowdin.yaml"); public static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("messages/messages"); diff --git a/src/main/java/com/crowdin/cli/commands/picocli/InitSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/InitSubcommand.java index 09c8be56..10cd0f6e 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/InitSubcommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/InitSubcommand.java @@ -42,7 +42,7 @@ public class InitSubcommand extends GenericActCommand { @CommandLine.Option(names = {"--preserve-hierarchy"}, negatable = true, paramLabel = "...", descriptionKey = "params.preserve-hierarchy", order = -2) private Boolean preserveHierarchy; - @CommandLine.Option(names = "--skip-generate-description", hidden = true) + @CommandLine.Option(names = "--quite", descriptionKey = "params.quite", order = -2) private boolean skipGenerateDescription; protected NewAction getAction(Actions actions) { diff --git a/src/main/resources/messages/messages.properties b/src/main/resources/messages/messages.properties index 4075ec12..e09bc4d1 100755 --- a/src/main/resources/messages/messages.properties +++ b/src/main/resources/messages/messages.properties @@ -24,6 +24,7 @@ params.source=Path to the source files params.translation=Path to the translation files params.dest=Specify file name in Crowdin params.preserve-hierarchy=Choose whether to save the directory hierarchy in the Crowdin project +params.quite=Do not ask for interactive input prompts params.skipUntranslatedStrings=Skip untranslated strings in exported files (does not work with .docx, .html, .md and other document files) params.skipUntranslatedFiles=Omit downloading not fully translated files params.keepArchive=Do not remove the downloaded archive with translations after it's extracting diff --git a/website/blog/2024-05-28-cli-v4/index.md b/website/blog/2024-05-28-cli-v4/index.md index fc7299df..ffc94999 100644 --- a/website/blog/2024-05-28-cli-v4/index.md +++ b/website/blog/2024-05-28-cli-v4/index.md @@ -136,6 +136,8 @@ The `generate` alias has been removed: +crowdin init ``` +New `quite` option was added to not ask for interactive input prompts. + ### Lint The `lint` command has been replaced with the [`config lint`](/commands/crowdin-config-lint) command: