Skip to content

Commit

Permalink
remove export pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
yevheniyJ committed Sep 23, 2024
1 parent 6ba65aa commit 52df649
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/crowdin/cli/commands/Actions.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ NewAction<PropertiesWithFiles, ProjectClient> preTranslate(

NewAction<ProjectProperties, ProjectClient> branchDelete(String name);

NewAction<ProjectProperties, ProjectClient> branchEdit(String branch, String name, String title, Priority priority, String exportPattern, boolean noProgress, boolean plainView);
NewAction<ProjectProperties, ProjectClient> branchEdit(String branch, String name, String title, Priority priority, boolean noProgress, boolean plainView);

NewAction<ProjectProperties, ClientScreenshot> screenshotList(Long stringId, boolean plainView);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ class BranchEditAction implements NewAction<ProjectProperties, ProjectClient> {
private final String name;
private final String title;
private final Priority priority;
private final String exportPattern;
private final boolean noProgress;
private final boolean plainView;

BranchEditAction(String branch, String name, String title, Priority priority, String exportPattern, boolean noProgress, boolean plainView) {
BranchEditAction(String branch, String name, String title, Priority priority, boolean noProgress, boolean plainView) {
this.branch = branch;
this.name = name;
this.title = title;
this.priority = priority;
this.exportPattern = exportPattern;
this.noProgress = noProgress;
this.plainView = plainView;
}
Expand Down Expand Up @@ -63,10 +61,6 @@ public void act(Outputter out, ProjectProperties pb, ProjectClient client) {
PatchRequest request = RequestBuilder.patch(priority, PatchOperation.REPLACE, "/priority");
requests.add(request);
}
if (exportPattern != null) {
PatchRequest request = RequestBuilder.patch(exportPattern, PatchOperation.REPLACE, "/exportPattern");
requests.add(request);
}

Branch updatedBranch = client.editBranch(branchObj.get().getId(), requests);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ public NewAction<ProjectProperties, ProjectClient> branchDelete(String name) {
}

@Override
public NewAction<ProjectProperties, ProjectClient> branchEdit(String branch, String name, String title, Priority priority, String exportPattern, boolean noProgress, boolean plainView) {
return new BranchEditAction(branch, name, title, priority, exportPattern, noProgress, plainView);
public NewAction<ProjectProperties, ProjectClient> branchEdit(String branch, String name, String title, Priority priority, boolean noProgress, boolean plainView) {
return new BranchEditAction(branch, name, title, priority, noProgress, plainView);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,20 @@ class BranchEditSubcommand extends ActCommandProject {
@CommandLine.Option(names = "--priority", descriptionKey = "crowdin.branch.edit.priority", paramLabel = "...", order = -2)
protected Priority priority;

@CommandLine.Option(names = "--export-pattern", descriptionKey = "crowdin.branch.edit.export-pattern", paramLabel = "...", order = -2)
protected String exportPattern;

@CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain")
protected boolean plainView;

@Override
protected List<String> checkOptions() {
List<String> errors = new ArrayList<>();
if (newName == null && title == null && priority == null && exportPattern == null) {
if (newName == null && title == null && priority == null) {
errors.add(RESOURCE_BUNDLE.getString("error.branch_no_edit"));
}
return errors;
}

@Override
protected NewAction<ProjectProperties, ProjectClient> getAction(Actions actions) {
return actions.branchEdit(name, newName, title, priority, exportPattern, noProgress, plainView);
return actions.branchEdit(name, newName, title, priority, noProgress, plainView);
}
}
1 change: 0 additions & 1 deletion src/main/resources/messages/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ crowdin.branch.edit.name=Branch name
crowdin.branch.edit.new-name=Rename branch
crowdin.branch.edit.title=Specify new title for the branch
crowdin.branch.edit.priority=Specify new priority for the branch
crowdin.branch.edit.export-pattern=Specify new export pattern for the branch

crowdin.glossary.upload.usage.description=Upload glossary to localization resources
crowdin.glossary.upload.usage.customSynopsis=@|fg(green) crowdin glossary upload|@ <file> [CONFIG OPTIONS] [OPTIONS]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class BranchEditActionTest {

@ParameterizedTest
@MethodSource
public void testBranchEdit(String branch, String name, String title, Priority priority, String exportPattern) {
public void testBranchEdit(String branch, String name, String title, Priority priority) {
Long branchId = 1L;

NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder
Expand All @@ -45,7 +45,7 @@ public void testBranchEdit(String branch, String name, String title, Priority pr

when(client.editBranch(any(), any())).thenReturn(new Branch());

action = new BranchEditAction(branch, name, title, priority, exportPattern, false, false);
action = new BranchEditAction(branch, name, title, priority, false, false);
action.act(Outputter.getDefault(), pb, client);

List<PatchRequest> patches = new ArrayList<>() {{
Expand All @@ -58,20 +58,16 @@ public void testBranchEdit(String branch, String name, String title, Priority pr
if (priority != null) {
add(RequestBuilder.patch(priority, PatchOperation.REPLACE, "/priority"));
}
if (exportPattern != null) {
add(RequestBuilder.patch(exportPattern, PatchOperation.REPLACE, "/exportPattern"));
}
}};
verify(client).editBranch(branchId, patches);
}

public static Stream<Arguments> testBranchEdit() {
return Stream.of(
arguments("main", "dev", null, null, null),
arguments("main", null, "test", null, null),
arguments("main", null, null, Priority.HIGH, null),
arguments("main", null, null, null, "%three_letters_code%"),
arguments("main", "dev", "test", Priority.HIGH, "%three_letters_code%")
arguments("main", "dev", null, null),
arguments("main", null, "test", null),
arguments("main", null, null, Priority.HIGH),
arguments("main", "dev", "test", Priority.HIGH)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void testBranchEdit() {
Priority priority = Priority.HIGH;
this.execute(CommandNames.BRANCH, CommandNames.EDIT, branchName, "--priority", priority.name());
verify(actionsMock)
.branchEdit(branchName, null, null, priority, null, false, false);
.branchEdit(branchName, null, null, priority, false, false);
this.check(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void mockActions() {
.thenReturn(actionMock);
when(actionsMock.branchMerge(any(), any(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean()))
.thenReturn(actionMock);
when(actionsMock.branchEdit(any(), any(), any(), any(), any(), anyBoolean(), anyBoolean()))
when(actionsMock.branchEdit(any(), any(), any(), any(), anyBoolean(), anyBoolean()))
.thenReturn(actionMock);
}

Expand Down

0 comments on commit 52df649

Please sign in to comment.