Skip to content

Commit

Permalink
feat: quite option for init command (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
yevheniyJ authored May 16, 2024
1 parent 81d0b09 commit ebbe795
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 27 deletions.
28 changes: 2 additions & 26 deletions src/main/java/com/crowdin/cli/BaseCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,22 @@

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;

/**
* Created by ihor on 12/1/16.
*/
public class BaseCli {

public static final List<String> DEFAULT_CONFIGS = Collections.unmodifiableList(Arrays.asList("crowdin.yml", "crowdin.yaml"));
public static final List<String> 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<String> 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<String, String> FILE_FORMAT_MAPPER = Collections.unmodifiableMap(new HashMap<String, String>() {{
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<String> 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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class InitSubcommand extends GenericActCommand<NoProperties, NoClient> {
@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<NoProperties, NoClient> getAction(Actions actions) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/messages/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions website/blog/2024-05-28-cli-v4/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ebbe795

Please sign in to comment.