-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afffab0
commit d5af295
Showing
15 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/com/crowdin/cli/commands/actions/BundleBrowseAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.crowdin.cli.commands.actions; | ||
|
||
import com.crowdin.cli.client.ClientBundle; | ||
import com.crowdin.cli.commands.NewAction; | ||
import com.crowdin.cli.commands.Outputter; | ||
import com.crowdin.cli.properties.ProjectProperties; | ||
import lombok.AllArgsConstructor; | ||
|
||
import java.awt.*; | ||
import java.net.URI; | ||
|
||
@AllArgsConstructor | ||
class BundleBrowseAction implements NewAction<ProjectProperties, ClientBundle> { | ||
|
||
Long id; | ||
|
||
@Override | ||
public void act(Outputter out, ProjectProperties pb, ClientBundle client) { | ||
try { | ||
Desktop.getDesktop().browse(new URI(client.getBundleUrl(id))); | ||
} catch (Exception e) { | ||
throw new RuntimeException("Unexpected error"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/com/crowdin/cli/commands/picocli/BundleBrowseSubcommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.crowdin.cli.commands.picocli; | ||
|
||
import com.crowdin.cli.client.ClientBundle; | ||
import com.crowdin.cli.client.ProjectClient; | ||
import com.crowdin.cli.commands.Actions; | ||
import com.crowdin.cli.commands.NewAction; | ||
import com.crowdin.cli.commands.Outputter; | ||
import com.crowdin.cli.properties.ProjectProperties; | ||
import picocli.CommandLine; | ||
|
||
@CommandLine.Command( | ||
name = CommandNames.BROWSE, | ||
sortOptions = false | ||
) | ||
class BundleBrowseSubcommand extends ActCommandBundle { | ||
|
||
@CommandLine.Parameters(descriptionKey = "crowdin.bundle.browse.id") | ||
protected Long id; | ||
|
||
@Override | ||
protected NewAction<ProjectProperties, ClientBundle> getAction(Actions actions) { | ||
return actions.bundleBrowse(id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/test/java/com/crowdin/cli/commands/picocli/BundleBrowseSubcommandTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.crowdin.cli.commands.picocli; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.Mockito.verify; | ||
|
||
public class BundleBrowseSubcommandTest extends PicocliTestUtils { | ||
|
||
@Test | ||
public void testBundleBrowseInvalidOptions() { | ||
this.executeInvalidParams(CommandNames.BUNDLE, CommandNames.BROWSE); | ||
} | ||
|
||
@Test | ||
public void testProjectBrowse() { | ||
this.execute(CommandNames.BUNDLE, CommandNames.BROWSE, "1"); | ||
verify(actionsMock).bundleBrowse(any()); | ||
this.check(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
:includedir: ../generated-picocli-docs | ||
:command: crowdin-bundle-browse | ||
|
||
== crowdin bundle browse | ||
|
||
include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] | ||
|
||
include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] | ||
|
||
include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] | ||
|
||
include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] | ||
|
||
include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] | ||
|
||
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-bundle[`crowdin bundle` command] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters