Skip to content

Commit 1cd3ec5

Browse files
authored
chore: crowdin distribution deprecations (#1017)
1 parent 095c134 commit 1cd3ec5

5 files changed

Lines changed: 21 additions & 4 deletions

File tree

src/main/java/com/crowdin/cli/commands/actions/DistributionAddAction.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import static com.crowdin.cli.BaseCli.RESOURCE_BUNDLE;
3030
import static com.crowdin.cli.utils.console.ExecutionStatus.OK;
31+
import static com.crowdin.cli.utils.console.ExecutionStatus.WARNING;
3132
import static com.crowdin.client.distributions.model.ExportMode.DEFAULT;
3233

3334
@AllArgsConstructor
@@ -53,6 +54,13 @@ public void act(Outputter out, ProjectProperties pb, ClientDistribution client)
5354
);
5455
boolean isStringsBasedProject = Objects.equals(project.getType(), Type.STRINGS_BASED);
5556

57+
if (exportMode != null) {
58+
out.println(WARNING.withIcon(RESOURCE_BUNDLE.getString("warning.distribution.deprecated_export_mode")));
59+
}
60+
if (files != null) {
61+
out.println(WARNING.withIcon(RESOURCE_BUNDLE.getString("warning.distribution.deprecated_file")));
62+
}
63+
5664
if (isStringsBasedProject && exportMode != null) {
5765
throw new ExitCodeExceptionMapper.ValidationException(RESOURCE_BUNDLE.getString("error.distribution.strings_based_export_mode"));
5866
}

src/main/java/com/crowdin/cli/commands/actions/DistributionEditAction.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ public void act(Outputter out, ProjectProperties pb, ClientDistribution client)
6464
}
6565
String existingExportMode = foundDistribution.get().getExportMode();
6666

67+
if (exportMode != null) {
68+
out.println(ExecutionStatus.WARNING.withIcon(RESOURCE_BUNDLE.getString("warning.distribution.deprecated_export_mode")));
69+
}
70+
if (files != null) {
71+
out.println(ExecutionStatus.WARNING.withIcon(RESOURCE_BUNDLE.getString("warning.distribution.deprecated_file")));
72+
}
73+
6774
List<PatchRequest> requests = new ArrayList<>();
6875

6976
if (name != null) {

src/main/java/com/crowdin/cli/commands/picocli/DistributionAddSubcommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class DistributionAddSubcommand extends ActCommandDistribution {
2323
@CommandLine.Parameters(descriptionKey = "crowdin.distribution.add.name")
2424
protected String name;
2525

26-
@CommandLine.Option(names = {"--export-mode"}, paramLabel = "...", descriptionKey = "crowdin.distribution.add.export-mode", defaultValue = "default", order = -2)
26+
@CommandLine.Option(names = {"--export-mode"}, paramLabel = "...", descriptionKey = "crowdin.distribution.add.export-mode", order = -2, hidden = true)
2727
protected ExportMode exportMode;
2828

29-
@CommandLine.Option(names = {"--file"}, paramLabel = "...", descriptionKey = "crowdin.distribution.add.file", order = -2)
29+
@CommandLine.Option(names = {"--file"}, paramLabel = "...", descriptionKey = "crowdin.distribution.add.file", order = -2, hidden = true)
3030
protected List<String> files;
3131

3232
@CommandLine.Option(names = {"--bundle-id"}, paramLabel = "...", descriptionKey = "crowdin.distribution.add.bundle-id", order = -2)

src/main/java/com/crowdin/cli/commands/picocli/DistributionEditSubcommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ class DistributionEditSubcommand extends ActCommandDistribution {
2222
@CommandLine.Option(names = {"--name"}, paramLabel = "...", descriptionKey = "crowdin.distribution.edit.name", order = -2)
2323
protected String name;
2424

25-
@CommandLine.Option(names = {"--export-mode"}, paramLabel = "...", descriptionKey = "crowdin.distribution.edit.export-mode", order = -2)
25+
@CommandLine.Option(names = {"--export-mode"}, paramLabel = "...", descriptionKey = "crowdin.distribution.edit.export-mode", order = -2, hidden = true)
2626
protected ExportMode exportMode;
2727

28-
@CommandLine.Option(names = {"--file"}, paramLabel = "...", descriptionKey = "crowdin.distribution.edit.file", order = -2)
28+
@CommandLine.Option(names = {"--file"}, paramLabel = "...", descriptionKey = "crowdin.distribution.edit.file", order = -2, hidden = true)
2929
protected List<String> files;
3030

3131
@CommandLine.Option(names = {"--bundle-id"}, paramLabel = "...", descriptionKey = "crowdin.distribution.edit.bundle-id", order = -2)

src/main/resources/messages/messages.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,8 @@ error.distribution.incorrect_bundle_id_command_usage=The '--bundle-id' is used o
682682
error.distribution.strings_based_export_mode=String-based projects do not support export mode setting
683683
error.distribution.no_edit=Specify the parameters to edit the distribution
684684
error.distribution.not_found=Couldn't find distribution with the specified hash %s
685+
warning.distribution.deprecated_export_mode=The '--export-mode' option is deprecated and will be removed in the next major release. Use '--bundle-id' instead
686+
warning.distribution.deprecated_file=The '--file' option is deprecated and will be removed in the next major release. Use '--bundle-id' instead
685687

686688
error.pre_translate.directory_or_file_only=Either '--file' or '--directory' can be specified
687689
error.pre_translate.engine_id=Machine Translation should be used with the '--engine-id' parameter

0 commit comments

Comments
 (0)