Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bundle download #795

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion website/mantemplates/crowdin-bundle-add.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer]
=== See also

* link:https://support.crowdin.com/bundles/[Target File Bundles]
* link:/crowdin-cli/commands/crowdin-download-bundle[`crowdin download bundle` command]
* link:/crowdin-cli/commands/crowdin-bundle-download[`crowdin bundle download` command]
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/mantemplates/crowdin-bundle-list.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer]
=== See also

* link:https://support.crowdin.com/bundles/[Target File Bundles]
* link:/crowdin-cli/commands/crowdin-download-bundle[`crowdin download bundle` command]
* link:/crowdin-cli/commands/crowdin-bundle-download[`crowdin bundle download` command]
2 changes: 1 addition & 1 deletion website/mantemplates/crowdin-bundle.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer]
=== See also

* link:https://support.crowdin.com/bundles/[Target File Bundles]
* link:/crowdin-cli/commands/crowdin-download-bundle[`crowdin download bundle` command]
* link:/crowdin-cli/commands/crowdin-bundle-download[`crowdin bundle download` command]
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
Loading