Skip to content

Commit

Permalink
feat: bundle download
Browse files Browse the repository at this point in the history
  • Loading branch information
yevheniyJ committed May 16, 2024
1 parent a365963 commit fd6fd1b
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import static com.crowdin.cli.utils.console.ExecutionStatus.ERROR;
import static com.crowdin.cli.utils.console.ExecutionStatus.OK;

public class DownloadBundleAction implements NewAction<ProjectProperties, ClientBundle> {
public class BundleDownloadAction implements NewAction<ProjectProperties, ClientBundle> {

private final Long id;
private final FilesInterface files;
Expand All @@ -34,7 +34,7 @@ public class DownloadBundleAction implements NewAction<ProjectProperties, Client

private Outputter out;

public DownloadBundleAction(Long id, FilesInterface files, boolean plainView, boolean keepArchive, boolean noProgress, boolean dryrun) {
public BundleDownloadAction(Long id, FilesInterface files, boolean plainView, boolean keepArchive, boolean noProgress, boolean dryrun) {
this.id = id;
this.files = files;
this.plainView = plainView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import com.crowdin.cli.client.ClientBundle;
import com.crowdin.cli.commands.Actions;
import com.crowdin.cli.commands.NewAction;
import com.crowdin.cli.commands.actions.DownloadBundleAction;
import com.crowdin.cli.commands.actions.BundleDownloadAction;
import com.crowdin.cli.commands.functionality.FsFiles;
import com.crowdin.cli.properties.ProjectProperties;
import picocli.CommandLine;

@CommandLine.Command(
name = CommandNames.BUNDLE,
name = CommandNames.DOWNLOAD,
sortOptions = false
)
public class DownloadBundleSubcommand extends ActCommandBundle {
public class BundleDownloadSubcommand extends ActCommandBundle {

@CommandLine.Parameters(descriptionKey = "crowdin.bundle.download.id")
protected Long id;
Expand All @@ -28,6 +28,6 @@ public class DownloadBundleSubcommand extends ActCommandBundle {

@Override
protected NewAction<ProjectProperties, ClientBundle> getAction(Actions actions) {
return new DownloadBundleAction(id, new FsFiles(), plainView, keepArchive, noProgress, dryrun);
return new BundleDownloadAction(id, new FsFiles(), plainView, keepArchive, noProgress, dryrun);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
name = CommandNames.BUNDLE,
subcommands = {
BundleListSubcommand.class,
BundleAddSubcommand.class
BundleAddSubcommand.class,
BundleDownloadSubcommand.class,
}
)
class BundleSubcommand extends HelpCommand {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
sortOptions = false,
aliases = CommandNames.ALIAS_DOWNLOAD,
subcommands = {
DownloadBundleSubcommand.class,
DownloadSourcesSubcommand.class
}
)
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/messages/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ crowdin.download.all=Download files even if local sources are missing
crowdin.download.sources.usage.description=Download sources from Crowdin to the specified place
crowdin.download.sources.usage.customSynopsis=@|fg(green) crowdin |@(@|fg(green) download|@|@|fg(green) pull|@) @|fg(green) sources|@ [CONFIG OPTIONS] [OPTIONS]

# CROWDIN DOWNLOAD BUNDLE COMMAND
crowdin.download.bundle.usage.description=Download bundle
crowdin.download.bundle.usage.customSynopsis=@|fg(green) crowdin download bundle <id>|@

# CROWDIN INIT COMMAND
crowdin.init.usage.description=Generate Crowdin CLI configuration skeleton
crowdin.init.usage.customSynopsis=@|fg(green) crowdin init|@ [CONFIG OPTIONS] [OPTIONS]
Expand Down Expand Up @@ -338,6 +334,10 @@ crowdin.bundle.add.ignore=Ignore pattern. Could be specified multiple times
crowdin.bundle.add.translation=Bundle export pattern. Defines bundle name in resulting translations bundle
crowdin.bundle.add.label=Label identifier. Could be specified multiple times

# CROWDIN BUNDLE DOWNLOAD COMMAND
crowdin.bundle.download.usage.description=Download bundle
crowdin.bundle.download.usage.customSynopsis=@|fg(green) crowdin bundle download <id>|@

# CROWDIN COMMENT COMMAND
crowdin.comment.usage.description=Manage string comments and issues
crowdin.comment.usage.customSynopsis=@|fg(green) crowdin comment|@ [SUBCOMMAND] [CONFIG OPTIONS] [OPTIONS]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

import static org.mockito.Mockito.*;

public class DownloadBundleActionTest {
public class BundleDownloadActionTest {

TempProject project;

@BeforeEach
public void createProj() {
project = new TempProject(DownloadBundleActionTest.class);
project = new TempProject(BundleDownloadActionTest.class);
}

@AfterEach
Expand Down Expand Up @@ -63,7 +63,7 @@ public void testDownloadBundle() {
FilesInterface files = mock(FilesInterface.class);

NewAction<ProjectProperties, ClientBundle> action =
new DownloadBundleAction(bundle.getId(), files, false, false, false, false);
new BundleDownloadAction(bundle.getId(), files, false, false, false, false);
action.act(Outputter.getDefault(), pb, client);

verify(client).getBundle(bundle.getId());
Expand Down Expand Up @@ -101,7 +101,7 @@ public void testDryRun() {
FilesInterface files = mock(FilesInterface.class);

NewAction<ProjectProperties, ClientBundle> action =
new DownloadBundleAction(bundle.getId(), files, false, false, false, true);
new BundleDownloadAction(bundle.getId(), files, false, false, false, true);
action.act(Outputter.getDefault(), pb, client);

verify(client).getBundle(bundle.getId());
Expand Down
4 changes: 4 additions & 0 deletions website/blog/2024-05-28-cli-v4/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ The `lint` command has been replaced with the [`config lint`](/commands/crowdin-
+ crowdin config lint
```

### Bundle

The `download bundle` command has been replaced with the [`bundle download`](/commands/crowdin-bundle-download) command.

## Exit codes

This release also includes more exit codes (previously we only had `0` for success and `1` for failure).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
:includedir: ../generated-picocli-docs
:command: crowdin-download-bundle
:command: crowdin-bundle-download

== crowdin download bundle
== crowdin bundle download

include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description]

Expand Down
2 changes: 1 addition & 1 deletion website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const sidebars = {
items: [
'commands/crowdin-download-translations',
'commands/crowdin-download-sources',
'commands/crowdin-download-bundle',
]
},
{
Expand Down Expand Up @@ -172,6 +171,7 @@ const sidebars = {
items: [
'commands/crowdin-bundle-list',
'commands/crowdin-bundle-add',
'commands/crowdin-bundle-download',
]
},
{
Expand Down

0 comments on commit fd6fd1b

Please sign in to comment.