diff --git a/src/main/java/com/crowdin/cli/commands/actions/CliActions.java b/src/main/java/com/crowdin/cli/commands/actions/CliActions.java index 51a3ef439..d784a3d5b 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/CliActions.java +++ b/src/main/java/com/crowdin/cli/commands/actions/CliActions.java @@ -87,7 +87,7 @@ public NewAction stringAdd( @Override public NewAction stringComment(boolean plainView, String text, String stringId, String language, String type, String issueType) { - return new StringCommentAction(plainView, text, stringId, language, type, issueType); + return new CommentAddAction(plainView, text, stringId, language, type, issueType); } @Override diff --git a/src/main/java/com/crowdin/cli/commands/actions/StringCommentAction.java b/src/main/java/com/crowdin/cli/commands/actions/CommentAddAction.java similarity index 95% rename from src/main/java/com/crowdin/cli/commands/actions/StringCommentAction.java rename to src/main/java/com/crowdin/cli/commands/actions/CommentAddAction.java index e9c007062..083251e81 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/StringCommentAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/CommentAddAction.java @@ -14,7 +14,7 @@ import static com.crowdin.cli.utils.console.ExecutionStatus.OK; @AllArgsConstructor -class StringCommentAction implements NewAction { +class CommentAddAction implements NewAction { private final boolean plainView; private final String text; diff --git a/src/main/java/com/crowdin/cli/commands/picocli/StringCommentSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/CommentAddSubcommand.java similarity index 83% rename from src/main/java/com/crowdin/cli/commands/picocli/StringCommentSubcommand.java rename to src/main/java/com/crowdin/cli/commands/picocli/CommentAddSubcommand.java index b61ba06f8..cef86da84 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/StringCommentSubcommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/CommentAddSubcommand.java @@ -17,23 +17,23 @@ @CommandLine.Command( sortOptions = false, - name = CommandNames.STRING_COMMENT + name = CommandNames.ADD ) -class StringCommentSubcommand extends ActCommandProject { +class CommentAddSubcommand extends ActCommandProject { - @CommandLine.Parameters(descriptionKey = "crowdin.string.comment.text") + @CommandLine.Parameters(descriptionKey = "crowdin.comment.add.text") protected String text; - @CommandLine.Option(names = {"--string-id"}, paramLabel = "...", descriptionKey = "crowdin.string.comment.string-id", order = -2) + @CommandLine.Option(names = {"--string-id"}, paramLabel = "...", descriptionKey = "crowdin.comment.add.string-id", order = -2) protected String stringId; - @CommandLine.Option(names = {"-l", "--language"}, paramLabel = "...", descriptionKey = "crowdin.string.comment.language", order = -2) + @CommandLine.Option(names = {"-l", "--language"}, paramLabel = "...", descriptionKey = "crowdin.comment.add.language", order = -2) protected String languageId; - @CommandLine.Option(names = {"--type"}, paramLabel = "...", descriptionKey = "crowdin.string.comment.type", order = -2) + @CommandLine.Option(names = {"--type"}, paramLabel = "...", descriptionKey = "crowdin.comment.add.type", order = -2) protected String type; - @CommandLine.Option(names = {"--issue-type"}, paramLabel = "...", descriptionKey = "crowdin.string.comment.issue-type", order = -2) + @CommandLine.Option(names = {"--issue-type"}, paramLabel = "...", descriptionKey = "crowdin.comment.add.issue-type", order = -2) protected String issueType; @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") diff --git a/src/main/java/com/crowdin/cli/commands/picocli/CommentSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/CommentSubcommand.java index 286a41798..937c8f585 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/CommentSubcommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/CommentSubcommand.java @@ -6,7 +6,8 @@ name = CommandNames.COMMENT, subcommands = { CommentListSubcommand.class, - CommentResolveSubcommand.class + CommentResolveSubcommand.class, + CommentAddSubcommand.class } ) class CommentSubcommand extends HelpCommand { diff --git a/src/main/java/com/crowdin/cli/commands/picocli/StringSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/StringSubcommand.java index bb8b1f83f..5b8f6c057 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/StringSubcommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/StringSubcommand.java @@ -7,7 +7,6 @@ subcommands = { StringListSubcommand.class, StringAddSubcommand.class, - StringCommentSubcommand.class, StringDeleteSubcommand.class, StringEditSubcommand.class } diff --git a/src/main/resources/messages/messages.properties b/src/main/resources/messages/messages.properties index b09f91b09..c15d16da6 100755 --- a/src/main/resources/messages/messages.properties +++ b/src/main/resources/messages/messages.properties @@ -179,16 +179,6 @@ crowdin.string.add.few=Plural form few (paucal) crowdin.string.add.many=Plural form many crowdin.string.add.zero=Plural form zero -# CROWDIN STRING COMMENT COMMAND -crowdin.string.comment.usage.description=Add a comment to the given string -crowdin.string.comment.usage.customSynopsis=@|fg(green) crowdin string comment|@ [CONFIG OPTIONS] [OPTIONS] -crowdin.string.comment.text=String comment text -crowdin.string.comment.string-id=Numeric string identifier -crowdin.string.comment.language=Target language to which the comment belongs -crowdin.string.comment.type=Defines the comment type. Supported types: comment, issue -crowdin.string.comment.issue-type=Defines the issue type. Supported types: general_question, translation_mistake, context_request, source_mistake - - # CROWDIN STRING LIST COMMAND crowdin.string.list.usage.description=Show a list of source strings crowdin.string.list.usage.customSynopsis=@|fg(green) crowdin string list|@ [CONFIG OPTIONS] [OPTIONS] @@ -356,6 +346,15 @@ crowdin.comment.resolve.usage.description=Resolve reported issues with source st crowdin.comment.resolve.usage.customSynopsis=@|fg(green) crowdin comment resolve|@ [CONFIG OPTIONS] [OPTIONS] crowdin.comment.resolve.id=Numeric ID of the string comment +# CROWDIN COMMENT ADD COMMAND +crowdin.comment.add.usage.description=Add a comment to the given string +crowdin.comment.add.usage.customSynopsis=@|fg(green) crowdin comment add|@ [CONFIG OPTIONS] [OPTIONS] +crowdin.comment.add.text=String comment text +crowdin.comment.add.string-id=Numeric string identifier +crowdin.comment.add.language=Target language to which the comment belongs +crowdin.comment.add.type=Defines the comment type. Supported types: comment, issue +crowdin.comment.add.issue-type=Defines the issue type. Supported types: general_question, translation_mistake, context_request, source_mistake + # CROWDIN PRE-TRANSLATE crowdin.pre-translate.usage.description=Pre-translate files via Machine Translation (MT) or Translation Memory (TM) crowdin.pre-translate.usage.customSynopsis=@|fg(green) crowdin pre-translate|@ [CONFIG OPTIONS] [OPTIONS] diff --git a/src/test/java/com/crowdin/cli/commands/actions/StringCommentActionTest.java b/src/test/java/com/crowdin/cli/commands/actions/CommentAddActionTest.java similarity index 93% rename from src/test/java/com/crowdin/cli/commands/actions/StringCommentActionTest.java rename to src/test/java/com/crowdin/cli/commands/actions/CommentAddActionTest.java index 213667de2..1bd26b05f 100644 --- a/src/test/java/com/crowdin/cli/commands/actions/StringCommentActionTest.java +++ b/src/test/java/com/crowdin/cli/commands/actions/CommentAddActionTest.java @@ -21,7 +21,7 @@ import static org.junit.jupiter.params.provider.Arguments.arguments; import static org.mockito.Mockito.*; -public class StringCommentActionTest { +public class CommentAddActionTest { NewAction action; @@ -46,7 +46,7 @@ public void testStringComment(String text, String type, String languageId, Strin setIssueType(request.getIssueType()); setStringId(request.getStringId()); }}); - action = new StringCommentAction(true, text, stringId, languageId, type, issueType); + action = new CommentAddAction(true, text, stringId, languageId, type, issueType); action.act(Outputter.getDefault(), pb, client); verify(client).commentString(request); verifyNoMoreInteractions(client); @@ -71,7 +71,7 @@ public void testStringCommentThrows() { when(client.commentString(request)) .thenThrow(new RuntimeException("Whoops")); - action = new StringCommentAction(true, null, null, null, "comment", null); + action = new CommentAddAction(true, null, null, null, "comment", null); assertThrows(RuntimeException.class, () -> action.act(Outputter.getDefault(), pb, client)); diff --git a/src/test/java/com/crowdin/cli/commands/picocli/StringCommentSubcommandTest.java b/src/test/java/com/crowdin/cli/commands/picocli/CommentAddSubcommandTest.java similarity index 66% rename from src/test/java/com/crowdin/cli/commands/picocli/StringCommentSubcommandTest.java rename to src/test/java/com/crowdin/cli/commands/picocli/CommentAddSubcommandTest.java index 5969b54e9..e7046a0dc 100644 --- a/src/test/java/com/crowdin/cli/commands/picocli/StringCommentSubcommandTest.java +++ b/src/test/java/com/crowdin/cli/commands/picocli/CommentAddSubcommandTest.java @@ -6,11 +6,11 @@ import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.verify; -public class StringCommentSubcommandTest extends PicocliTestUtils { +public class CommentAddSubcommandTest extends PicocliTestUtils { @Test public void testStringComment() { - this.execute(CommandNames.STRING, CommandNames.STRING_COMMENT, "\"My Comment\"", "--string-id", "1", + this.execute(CommandNames.COMMENT, CommandNames.ADD, "\"My Comment\"", "--string-id", "1", "--language", "en", "--type", "comment"); verify(actionsMock) .stringComment(anyBoolean(), any(), any(), any(), any(), any()); @@ -19,7 +19,7 @@ public void testStringComment() { @Test public void testStringCommentInvalidOptions() { - this.executeInvalidParams(CommandNames.STRING, CommandNames.STRING_COMMENT, "\"My Comment\""); + this.executeInvalidParams(CommandNames.COMMENT, CommandNames.ADD, "\"My Comment\""); } } diff --git a/website/blog/2024-05-28-cli-v4/index.md b/website/blog/2024-05-28-cli-v4/index.md index db2d2b5ba..32e37a3ba 100644 --- a/website/blog/2024-05-28-cli-v4/index.md +++ b/website/blog/2024-05-28-cli-v4/index.md @@ -45,6 +45,7 @@ Tip: Use the [`file list`](/commands/crowdin-file-list) command to get the file * Moved `id` to parameter. Now only 1 string can be removed at a time. * Removed the `--text` and `--identifier` options. Only `id` is used as a string identifier. * Added `--directory` and `--scope` options to the [`string list`](/commands/crowdin-string-list) command. +* `comment` command was moved to [`comment add`](/commands/crowdin-comment-add) command. ```diff -crowdin string add Download --file main/src/strings.xml --identifier "download" diff --git a/website/mantemplates/crowdin-string-comment.adoc b/website/mantemplates/crowdin-comment-add.adoc similarity index 90% rename from website/mantemplates/crowdin-string-comment.adoc rename to website/mantemplates/crowdin-comment-add.adoc index e9b0653b6..453c85191 100644 --- a/website/mantemplates/crowdin-string-comment.adoc +++ b/website/mantemplates/crowdin-comment-add.adoc @@ -1,7 +1,7 @@ :includedir: ../generated-picocli-docs -:command: crowdin-string-comment +:command: crowdin-comment-add -== crowdin string comment +== crowdin comment add include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] diff --git a/website/sidebars.js b/website/sidebars.js index 741c92f68..9a3476d27 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -156,7 +156,6 @@ const sidebars = { 'commands/crowdin-string-add', 'commands/crowdin-string-edit', 'commands/crowdin-string-delete', - 'commands/crowdin-string-comment', ] }, { @@ -216,6 +215,7 @@ const sidebars = { items: [ 'commands/crowdin-comment-list', 'commands/crowdin-comment-resolve', + 'commands/crowdin-comment-add', ] }, {