├── src ├── test │ ├── resources │ │ ├── file.csv │ │ ├── file.tbx │ │ ├── file.tmx │ │ ├── file.txt │ │ └── mockito-extensions │ │ │ └── org.mockito.plugins.MockMaker │ └── java │ │ └── com │ │ └── crowdin │ │ └── cli │ │ ├── commands │ │ ├── picocli │ │ │ ├── RootCommandTest.java │ │ │ ├── TmSubcommandTest.java │ │ │ ├── ConfigSubcommandTest.java │ │ │ ├── ProjectSubcommandTest.java │ │ │ ├── StringSubcommandTest.java │ │ │ ├── GlossarySubcommandTest.java │ │ │ ├── CheckNewVersionSubcommandTest.java │ │ │ ├── ProjectListSubcommandTest.java │ │ │ ├── PicocliOutputterTest.java │ │ │ ├── ProjectBrowseSubcommandTest.java │ │ │ ├── TmListSubcommandTest.java │ │ │ ├── AppInstallSubcommandTest.java │ │ │ ├── AppListSubcommandTest.java │ │ │ ├── BundleDeleteSubcommandTest.java │ │ │ ├── ConfigLintSubcommandTest.java │ │ │ ├── LabelListSubcommandTest.java │ │ │ ├── BranchListSubcommandTest.java │ │ │ ├── GlossaryListSubcommandTest.java │ │ │ ├── DistributionListSubcommandTest.java │ │ │ ├── BundleListSubcommandTest.java │ │ │ ├── BranchCloneSubcommandTest.java │ │ │ ├── InitSubcommandTest.java │ │ │ ├── ScreenshotListSubcommandTest.java │ │ │ ├── CommentListSubcommandTest.java │ │ │ ├── FileListSubcommandTest.java │ │ │ ├── BranchMergeSubcommandTest.java │ │ │ ├── TaskListSubcommandTest.java │ │ │ ├── BundleCloneSubcommandTest.java │ │ │ ├── ConfigSourcesSubcommandTest.java │ │ │ ├── ConfigTranslationsSubcommandTest.java │ │ │ ├── FileDeleteSubcommandTest.java │ │ │ ├── BundleBrowseSubcommandTest.java │ │ │ ├── StatusSubcommandTest.java │ │ │ ├── LabelDeleteSubcommandTest.java │ │ │ ├── PreTranslateSubcommandTest.java │ │ │ ├── ScreenshotDeleteSubcommandTest.java │ │ │ ├── LabelAddSubcommandTest.java │ │ │ ├── StatusProofreadingSubcommandTest.java │ │ │ ├── StatusTranslationsSubcommandTest.java │ │ │ ├── StringDeleteSubcommandTest.java │ │ │ ├── ProjectAddSubcommandTest.java │ │ │ ├── AppUninstallSubcommandTest.java │ │ │ ├── CommentAddSubcommandTest.java │ │ │ ├── UploadSourcesCommandTest.java │ │ │ ├── StringListSubcommandTest.java │ │ │ ├── BranchEditSubcommandTest.java │ │ │ ├── StringEditSubcommandTest.java │ │ │ ├── FileDownloadSubcommandTest.java │ │ │ ├── UploadTranslationsSubcommandTest.java │ │ │ ├── CommentResolveSubcommandTest.java │ │ │ ├── TmUploadSubcommandTest.java │ │ │ └── StringAddSubcommandTest.java │ │ └── functionality │ │ │ └── BranchUtilsTest.java │ │ ├── utils │ │ ├── AssertUtils.java │ │ ├── PlaceholderUtilBuilder.java │ │ ├── LanguageBuilder.java │ │ └── concurrency │ │ │ └── ConcurrencyUtilsTest.java │ │ ├── WorkWithProjectTestPart.java │ │ ├── MockitoUtils.java │ │ └── properties │ │ ├── NewBasePropertiesUtilBuilder.java │ │ └── NewProjectPropertiesUtilBuilder.java └── main │ ├── java │ └── com │ │ └── crowdin │ │ └── cli │ │ ├── properties │ │ ├── Params.java │ │ ├── Properties.java │ │ ├── NoParams.java │ │ ├── NoProperties.java │ │ ├── AllProperties.java │ │ ├── ProjectParams.java │ │ ├── BeanConfigurator.java │ │ ├── PropertiesConfigurator.java │ │ ├── BaseParams.java │ │ └── SettingsBean.java │ │ ├── client │ │ ├── NoClient.java │ │ ├── FileInUpdateException.java │ │ ├── WaitResponseException.java │ │ ├── ExistsResponseException.java │ │ ├── NotUniqueResponseException.java │ │ ├── WrongLanguageException.java │ │ ├── AutoTagInProgressException.java │ │ ├── MaxNumberOfRetriesException.java │ │ ├── EmptyFileException.java │ │ ├── ResponseException.java │ │ ├── RepeatException.java │ │ ├── ClientLabel.java │ │ ├── ClientTask.java │ │ ├── ClientComment.java │ │ ├── ClientScreenshot.java │ │ ├── ClientBundle.java │ │ ├── ClientDistribution.java │ │ ├── CrowdinClientTask.java │ │ └── CrowdinClientLabel.java │ │ ├── utils │ │ ├── tree │ │ │ ├── Visitable.java │ │ │ ├── Visitor.java │ │ │ └── DrawTree.java │ │ ├── http │ │ │ ├── HttpListener.java │ │ │ └── ServerSocketFactory.java │ │ ├── console │ │ │ └── ExecutionStatus.java │ │ └── OutputUtil.java │ │ └── commands │ │ ├── picocli │ │ ├── CompletionSubCommand.java │ │ ├── UploadSourcesSubcommand.java │ │ ├── ActCommandTm.java │ │ ├── UploadSubcommand.java │ │ ├── ActCommandGlossary.java │ │ ├── LanguageSubcommand.java │ │ ├── TaskSubcommand.java │ │ ├── TmSubcommand.java │ │ ├── ProjectSubcommand.java │ │ ├── CommentSubcommand.java │ │ ├── ConfigSubcommand.java │ │ ├── GlossarySubcommand.java │ │ ├── LabelSubcommand.java │ │ ├── StringSubcommand.java │ │ ├── ApplicationSubcommand.java │ │ ├── ScreenshotSubcommand.java │ │ ├── FileSubcommand.java │ │ ├── DistributionSubcommand.java │ │ ├── BranchSubcommand.java │ │ ├── BundleSubcommand.java │ │ ├── CommentResolveSubcommand.java │ │ ├── ScreenshotDeleteSubcommand.java │ │ ├── StringDeleteSubcommand.java │ │ ├── BranchDeleteSubcommand.java │ │ ├── LabelDeleteSubcommand.java │ │ ├── AppInstallSubcommand.java │ │ ├── LabelListSubcommand.java │ │ ├── TmListSubcommand.java │ │ ├── BundleBrowseSubcommand.java │ │ ├── ProjectBrowseSubcommand.java │ │ ├── ProjectListSubcommand.java │ │ ├── HelpCommand.java │ │ ├── AppListSubcommand.java │ │ ├── BundleDeleteSubcommand.java │ │ ├── BundleListSubcommand.java │ │ ├── PicocliOutputter.java │ │ ├── BranchListSubcommand.java │ │ ├── GlossaryListSubcommand.java │ │ ├── LabelAddSubcommand.java │ │ ├── ActCommand.java │ │ ├── AppUninstallSubcommand.java │ │ ├── DistributionListSubcommand.java │ │ ├── FileDeleteSubcommand.java │ │ ├── DistributionReleaseSubcommand.java │ │ ├── ScreenshotListSubcommand.java │ │ ├── BranchCloneSubcommand.java │ │ ├── CheckVersionSubcommand.java │ │ ├── ConfigTranslationsSubcommand.java │ │ ├── ActCommandBundle.java │ │ ├── ActCommandComment.java │ │ ├── ActCommandProject.java │ │ ├── ActCommandLabel.java │ │ ├── ConfigSourcesSubcommand.java │ │ ├── RootCommand.java │ │ ├── FileListSubcommand.java │ │ ├── ActCommandTask.java │ │ ├── GenericCommand.java │ │ ├── ActCommandDistribution.java │ │ ├── ActCommandScreenshot.java │ │ └── LanguageListSubcommand.java │ │ ├── NewAction.java │ │ ├── functionality │ │ └── FilesInterface.java │ │ ├── actions │ │ ├── ProjectBrowseAction.java │ │ ├── BundleBrowseAction.java │ │ ├── StringDeleteAction.java │ │ ├── AppUninstallAction.java │ │ ├── AppListAction.java │ │ ├── ScreenshotDeleteAction.java │ │ └── AppInstallAction.java │ │ └── Outputter.java │ └── resources │ ├── crowdin.properties │ └── crowdin.yml ├── website ├── static │ ├── .nojekyll │ └── img │ │ ├── cli.png │ │ ├── favicon.ico │ │ ├── ci_cd_pipeline.png │ │ └── cli-demo-image.png ├── docs │ └── commands │ │ └── .gitkeep ├── babel.config.js ├── blog │ ├── 2024-05-28-cli-v4 │ │ └── img │ │ │ └── social-card.png │ └── authors.yml ├── tsconfig.json ├── .gitignore ├── mantemplates │ ├── crowdin-label-list.adoc │ ├── crowdin.adoc │ ├── crowdin-app.adoc │ ├── crowdin-file.adoc │ ├── crowdin-task.adoc │ ├── crowdin-branch.adoc │ ├── crowdin-config.adoc │ ├── crowdin-status.adoc │ ├── crowdin-string.adoc │ ├── crowdin-upload.adoc │ ├── crowdin-app-list.adoc │ ├── crowdin-comment.adoc │ ├── crowdin-language.adoc │ ├── crowdin-project.adoc │ ├── crowdin-task-add.adoc │ ├── crowdin-tm-list.adoc │ ├── crowdin-file-list.adoc │ ├── crowdin-task-list.adoc │ ├── crowdin-app-install.adoc │ ├── crowdin-branch-add.adoc │ ├── crowdin-branch-edit.adoc │ ├── crowdin-branch-list.adoc │ ├── crowdin-comment-add.adoc │ ├── crowdin-config-lint.adoc │ ├── crowdin-file-delete.adoc │ ├── crowdin-label.adoc │ ├── crowdin-project-add.adoc │ ├── crowdin-string-edit.adoc │ ├── crowdin-tm-download.adoc │ ├── crowdin-app-uninstall.adoc │ ├── crowdin-branch-delete.adoc │ ├── crowdin-comment-list.adoc │ ├── crowdin-distribution.adoc │ ├── crowdin-file-download.adoc │ ├── crowdin-glossary-list.adoc │ ├── crowdin-language-list.adoc │ ├── crowdin-project-list.adoc │ ├── crowdin-string-delete.adoc │ ├── crowdin-config-sources.adoc │ ├── crowdin-label-add.adoc │ ├── crowdin-project-browse.adoc │ ├── crowdin-upload-sources.adoc │ ├── crowdin-comment-resolve.adoc │ ├── crowdin-screenshot.adoc │ ├── crowdin-distribution-list.adoc │ ├── crowdin-glossary-download.adoc │ ├── crowdin-label-delete.adoc │ ├── crowdin-status-translation.adoc │ ├── crowdin-config-translations.adoc │ ├── crowdin-status-proofreading.adoc │ ├── crowdin-distribution-release.adoc │ ├── crowdin-screenshot-list.adoc │ ├── crowdin-screenshot-delete.adoc │ ├── crowdin-screenshot-upload.adoc │ ├── crowdin-glossary.adoc │ ├── crowdin-tm.adoc │ ├── crowdin-file-upload.adoc │ ├── crowdin-branch-clone.adoc │ ├── crowdin-branch-merge.adoc │ ├── crowdin-bundle-browse.adoc │ ├── crowdin-bundle.adoc │ ├── crowdin-distribution-edit.adoc │ ├── crowdin-bundle-add.adoc │ ├── crowdin-bundle-download.adoc │ ├── crowdin-bundle-list.adoc │ ├── crowdin-bundle-delete.adoc │ ├── crowdin-upload-translations.adoc │ ├── crowdin-pre-translate.adoc │ ├── crowdin-bundle-clone.adoc │ ├── crowdin-download-sources.adoc │ ├── crowdin-tm-upload.adoc │ └── crowdin-download.adoc ├── README.md └── src │ └── css │ └── custom.css ├── .github ├── codecov.yml ├── workflows │ ├── lint-pr-title.yml │ ├── dependency-analysis.yml │ ├── bump-version.yml │ └── codeql-analysis.yml └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── packages ├── chocolatey │ └── tools │ │ ├── chocolateyuninstall.ps1 │ │ └── chocolateyinstall.ps1 ├── zip │ ├── crowdin.bat │ └── crowdin └── docker │ └── Dockerfile ├── .gitignore ├── settings.gradle ├── snapcraft.yaml └── LICENSE /src/test/resources/file.csv: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/file.tbx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/file.tmx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /website/static/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /website/docs/commands/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/file.txt: -------------------------------------------------------------------------------- 1 | Some content here. -------------------------------------------------------------------------------- /.github/codecov.yml: -------------------------------------------------------------------------------- 1 | github_checks: 2 | annotations: false 3 | -------------------------------------------------------------------------------- /src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker: -------------------------------------------------------------------------------- 1 | mock-maker-inline -------------------------------------------------------------------------------- /website/static/img/cli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdin/crowdin-cli/HEAD/website/static/img/cli.png -------------------------------------------------------------------------------- /website/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdin/crowdin-cli/HEAD/website/static/img/favicon.ico -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdin/crowdin-cli/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /website/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/properties/Params.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.properties; 2 | 3 | public interface Params { 4 | } 5 | -------------------------------------------------------------------------------- /website/static/img/ci_cd_pipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdin/crowdin-cli/HEAD/website/static/img/ci_cd_pipeline.png -------------------------------------------------------------------------------- /website/static/img/cli-demo-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdin/crowdin-cli/HEAD/website/static/img/cli-demo-image.png -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/properties/Properties.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.properties; 2 | 3 | public interface Properties { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/NoClient.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | public interface NoClient extends Client { 4 | } 5 | -------------------------------------------------------------------------------- /packages/chocolatey/tools/chocolateyuninstall.ps1: -------------------------------------------------------------------------------- 1 | Uninstall-ChocolateyEnvironmentVariable -variableName 'CROWDIN_HOME' 2 | Uninstall-BinFile -name crowdin -------------------------------------------------------------------------------- /packages/zip/crowdin.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | IF "%CROWDIN_HOME%"=="" (ECHO crowdin is NOT defined) ELSE (java -jar "%CROWDIN_HOME%\crowdin-cli.jar" %*) 3 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/properties/NoParams.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.properties; 2 | 3 | public class NoParams implements Params { 4 | } 5 | -------------------------------------------------------------------------------- /website/blog/2024-05-28-cli-v4/img/social-card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crowdin/crowdin-cli/HEAD/website/blog/2024-05-28-cli-v4/img/social-card.png -------------------------------------------------------------------------------- /packages/zip/crowdin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | SCRIPT_DIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1; pwd -P)" 3 | exec java -jar "$SCRIPT_DIR/crowdin-cli.jar" $@ 4 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/properties/NoProperties.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.properties; 2 | 3 | public class NoProperties implements Properties { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/FileInUpdateException.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | public class FileInUpdateException extends ResponseException { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/WaitResponseException.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | public class WaitResponseException extends ResponseException { 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.gradle 2 | /.idea 3 | /build 4 | *.iml 5 | *.ipr 6 | *.iws 7 | crowdin.yml 8 | /testing 9 | dist 10 | jdeploy-bundle 11 | node_modules 12 | .DS_Store 13 | *.patch -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/ExistsResponseException.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | public class ExistsResponseException extends ResponseException { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/NotUniqueResponseException.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | public class NotUniqueResponseException extends ResponseException { 4 | } -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/WrongLanguageException.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | public class WrongLanguageException extends ResponseException { 4 | 5 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | 2 | plugins { 3 | // See https://splitties.github.io/refreshVersions 4 | id 'de.fayard.refreshVersions' version '0.60.5' 5 | } 6 | 7 | rootProject.name = 'cli' -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/AutoTagInProgressException.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | public class AutoTagInProgressException extends ResponseException { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/MaxNumberOfRetriesException.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | public class MaxNumberOfRetriesException extends ResponseException { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/utils/tree/Visitable.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.utils.tree; 2 | 3 | import java.util.List; 4 | 5 | interface Visitable { 6 | 7 | List accept(Visitor visitor); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /website/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // This file is not used in compilation. It is here just for a nice editor experience. 3 | "extends": "@tsconfig/docusaurus/tsconfig.json", 4 | "compilerOptions": { 5 | "baseUrl": "." 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/crowdin.properties: -------------------------------------------------------------------------------- 1 | application.name=crowdin-cli 2 | application.version=4.12.0 3 | application.base_url=https://api.crowdin.com 4 | application.version_file_url=https://github.com/crowdin/crowdin-cli/releases/latest/download/version.txt 5 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/EmptyFileException.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | public class EmptyFileException extends ResponseException { 4 | 5 | public EmptyFileException(String message) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/utils/http/HttpListener.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.utils.http; 2 | 3 | import java.io.PrintWriter; 4 | 5 | @FunctionalInterface 6 | interface HttpListener { 7 | void accept(HttpRequest request, PrintWriter responseOut); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/utils/tree/Visitor.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.utils.tree; 2 | 3 | interface Visitor { 4 | 5 | Visitor visitTree(Tree tree, boolean last); 6 | 7 | E visitData(Tree parent, T data); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/ResponseException.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | public class ResponseException extends Exception { 4 | 5 | public ResponseException() { 6 | 7 | } 8 | 9 | public ResponseException(String message) { 10 | super(message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/RootCommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | public class RootCommandTest extends PicocliTestUtils { 6 | 7 | @Test 8 | public void testRoot() { 9 | this.executeHelp(); 10 | } 11 | } -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/CompletionSubCommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.AutoComplete; 4 | import picocli.CommandLine; 5 | 6 | @CommandLine.Command(name = "completion", hidden = true) 7 | class CompletionSubCommand extends AutoComplete.GenerateCompletion { 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/RepeatException.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | class RepeatException extends ResponseException { 4 | 5 | public RepeatException() { 6 | super(); 7 | } 8 | 9 | public RepeatException(String message) { 10 | super(message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/UploadSourcesSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.UPLOAD_SOURCES, 7 | sortOptions = false 8 | ) 9 | class UploadSourcesSubcommand extends UploadSourcesCommand { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/TmSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | public class TmSubcommandTest extends PicocliTestUtils { 6 | 7 | @Test 8 | public void testTm() { 9 | this.executeHelp(CommandNames.TM); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/ConfigSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | public class ConfigSubcommandTest extends PicocliTestUtils { 6 | 7 | @Test 8 | public void testList() { 9 | this.executeHelp(CommandNames.CONFIG); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/ProjectSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | public class ProjectSubcommandTest extends PicocliTestUtils { 6 | 7 | @Test 8 | public void testString() { 9 | this.executeHelp(CommandNames.PROJECT); 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/StringSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | public class StringSubcommandTest extends PicocliTestUtils { 6 | 7 | @Test 8 | public void testString() { 9 | this.executeHelp(CommandNames.STRING); 10 | } 11 | } -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/NewAction.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands; 2 | 3 | import com.crowdin.cli.client.Client; 4 | import com.crowdin.cli.properties.Properties; 5 | 6 | @FunctionalInterface 7 | public interface NewAction

{ 8 | void act(Outputter out, P properties, C client); 9 | } 10 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/GlossarySubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | public class GlossarySubcommandTest extends PicocliTestUtils { 6 | 7 | @Test 8 | public void testGlossary() { 9 | this.executeHelp(CommandNames.GLOSSARY); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/properties/AllProperties.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.properties; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class AllProperties implements Properties { 7 | 8 | private ProjectProperties projectProperties = new ProjectProperties(); 9 | private PropertiesWithFiles propertiesWithFiles = new PropertiesWithFiles(); 10 | } 11 | -------------------------------------------------------------------------------- /website/blog/authors.yml: -------------------------------------------------------------------------------- 1 | andrii-bodnar: 2 | name: Andrii Bodnar 3 | title: Engineering Manager 4 | url: https://github.com/andrii-bodnar 5 | image_url: https://github.com/andrii-bodnar.png 6 | 7 | yevheniyJ: 8 | name: Yevheniy Oliynyk 9 | title: Full stack Java/NodeJS developer 10 | url: https://github.com/yevheniyJ 11 | image_url: https://github.com/yevheniyJ.png 12 | -------------------------------------------------------------------------------- /.github/workflows/lint-pr-title.yml: -------------------------------------------------------------------------------- 1 | name: Lint PR Title 2 | 3 | on: 4 | pull_request_target: 5 | types: 6 | - opened 7 | - reopened 8 | - edited 9 | - synchronize 10 | 11 | jobs: 12 | main: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: amannn/action-semantic-pull-request@v5 17 | env: 18 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 19 | -------------------------------------------------------------------------------- /.github/workflows/dependency-analysis.yml: -------------------------------------------------------------------------------- 1 | name: Dependency Analysis 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | schedule: 8 | - cron: '0 0 * * MON' 9 | workflow_dispatch: 10 | 11 | jobs: 12 | dependency-analysis: 13 | uses: crowdin/.github/.github/workflows/dependency-analysis.yml@main 14 | secrets: 15 | FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }} 16 | with: 17 | exclude-path: 'website' 18 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/ClientLabel.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | import com.crowdin.client.labels.model.AddLabelRequest; 4 | import com.crowdin.client.labels.model.Label; 5 | 6 | import java.util.List; 7 | 8 | public interface ClientLabel extends Client { 9 | 10 | List

{ 6 | 7 | void populateWithValues(P props, Map map); 8 | 9 | void populateWithDefaultValues(P props); 10 | 11 | void populateWithEnvValues(P props); 12 | 13 | PropertiesBuilder.Messages checkProperties(P props, CheckType checkType); 14 | 15 | enum CheckType { 16 | STANDARD, 17 | LINT 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/TmListSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.eq; 6 | import static org.mockito.Mockito.verify; 7 | 8 | public class TmListSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testTmList() { 12 | this.execute(CommandNames.TM, CommandNames.LIST); 13 | verify(actionsMock).tmList(eq(false)); 14 | this.check(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/TaskSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.TASK, 7 | subcommands = { 8 | TaskListSubcommand.class, 9 | TaskAddSubcommand.class 10 | } 11 | ) 12 | class TaskSubcommand extends HelpCommand { 13 | 14 | @Override 15 | protected CommandLine getCommand(CommandLine rootCommand) { 16 | return rootCommand.getSubcommands().get(CommandNames.TASK); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/AppInstallSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.Mockito.verify; 6 | 7 | public class AppInstallSubcommandTest extends PicocliTestUtils { 8 | 9 | @Test 10 | public void testAppInstall() { 11 | var appId = "test-app"; 12 | this.execute(CommandNames.APP, CommandNames.INSTALL, appId); 13 | verify(actionsMock).installApp(appId); 14 | this.check(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/AppListSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.anyBoolean; 6 | import static org.mockito.Mockito.verify; 7 | 8 | public class AppListSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testAppList() { 12 | this.execute(CommandNames.APP, CommandNames.LIST); 13 | verify(actionsMock).listApps(anyBoolean()); 14 | this.check(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | 3 | RUN apk --no-cache add sudo openjdk17-jre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community; 4 | 5 | ADD https://github.com/crowdin/crowdin-cli/releases/latest/download/crowdin-cli.zip /usr/ 6 | 7 | RUN unzip -j /usr/crowdin-cli.zip; \ 8 | sh install-crowdin-cli.sh; \ 9 | rm /usr/crowdin-cli.zip; \ 10 | rm *.*; 11 | 12 | RUN echo -e '#!/bin/sh\njava -jar /usr/local/bin/crowdin-cli.jar "$@"' > /usr/local/bin/crowdin; \ 13 | chmod +x /usr/local/bin/crowdin; 14 | 15 | WORKDIR /usr/crowdin-project 16 | 17 | CMD ["sh"] 18 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/TmSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.TM, 7 | subcommands = { 8 | TmListSubcommand.class, 9 | TmUploadSubcommand.class, 10 | TmDownloadSubcommand.class 11 | } 12 | ) 13 | class TmSubcommand extends HelpCommand { 14 | 15 | @Override 16 | protected CommandLine getCommand(CommandLine rootCommand) { 17 | return rootCommand.getSubcommands().get(CommandNames.TM); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/BundleDeleteSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.Mockito.verify; 7 | 8 | class BundleDeleteSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testBundleDelete() { 12 | this.execute(CommandNames.BUNDLE, CommandNames.DELETE, "1"); 13 | verify(actionsMock) 14 | .bundleDelete(any()); 15 | this.check(true); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/ConfigLintSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.Mockito.verify; 7 | import static org.mockito.Mockito.verifyNoMoreInteractions; 8 | 9 | public class ConfigLintSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testLint() { 13 | this.execute(CommandNames.CONFIG, CommandNames.LINT); 14 | verifyNoMoreInteractions(actionsMock); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/LabelListSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.anyBoolean; 6 | import static org.mockito.Mockito.verify; 7 | 8 | class LabelListSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testLabelList() { 12 | this.execute(CommandNames.LABEL, CommandNames.LIST); 13 | verify(actionsMock).labelList(anyBoolean(), anyBoolean()); 14 | this.check(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/ClientComment.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | import com.crowdin.client.stringcomments.model.IssueStatus; 4 | import com.crowdin.client.stringcomments.model.StringComment; 5 | 6 | import java.util.List; 7 | 8 | public interface ClientComment extends Client { 9 | 10 | List listComment(String stringId, com.crowdin.client.stringcomments.model.Type type, 11 | com.crowdin.client.issues.model.Type issueType, IssueStatus issueStatus); 12 | 13 | StringComment resolve(Long commentId); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/utils/http/ServerSocketFactory.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.utils.http; 2 | 3 | import java.io.IOException; 4 | import java.net.ServerSocket; 5 | 6 | interface ServerSocketFactory { 7 | 8 | ServerSocket get(int port); 9 | 10 | static ServerSocketFactory standard() { 11 | return port -> { 12 | try { 13 | return new ServerSocket(port); 14 | } catch (IOException e) { 15 | throw new RuntimeException("Unexpected error while creating local server"); 16 | } 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-label-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-label-list 3 | 4 | == crowdin label list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ProjectSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.PROJECT, 7 | subcommands = { 8 | ProjectBrowseSubcommand.class, 9 | ProjectListSubcommand.class, 10 | ProjectAddSubcommand.class 11 | } 12 | ) 13 | class ProjectSubcommand extends HelpCommand { 14 | @Override 15 | protected CommandLine getCommand(CommandLine rootCommand) { 16 | return rootCommand.getSubcommands().get(CommandNames.PROJECT); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/BranchListSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.anyBoolean; 6 | import static org.mockito.Mockito.verify; 7 | 8 | public class BranchListSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testListBranches() { 12 | this.execute(CommandNames.BRANCH, CommandNames.LIST); 13 | verify(actionsMock) 14 | .listBranches(anyBoolean(), anyBoolean()); 15 | this.check(true); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/GlossaryListSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.anyBoolean; 6 | import static org.mockito.Mockito.verify; 7 | 8 | public class GlossaryListSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testGlossaryList() { 12 | this.execute(CommandNames.GLOSSARY, CommandNames.LIST); 13 | verify(actionsMock) 14 | .glossaryList(anyBoolean(), anyBoolean()); 15 | check(true); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/CommentSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.COMMENT, 7 | subcommands = { 8 | CommentListSubcommand.class, 9 | CommentResolveSubcommand.class, 10 | CommentAddSubcommand.class 11 | } 12 | ) 13 | class CommentSubcommand extends HelpCommand { 14 | 15 | @Override 16 | protected CommandLine getCommand(CommandLine rootCommand) { 17 | return rootCommand.getSubcommands().get(CommandNames.COMMENT); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ConfigSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.CONFIG, 7 | subcommands = { 8 | ConfigSourcesSubcommand.class, 9 | ConfigTranslationsSubcommand.class, 10 | ConfigLintSubcommand.class 11 | } 12 | ) 13 | class ConfigSubcommand extends HelpCommand { 14 | 15 | @Override 16 | protected CommandLine getCommand(CommandLine rootCommand) { 17 | return rootCommand.getSubcommands().get(CommandNames.CONFIG); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/GlossarySubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.GLOSSARY, 7 | subcommands = { 8 | GlossaryListSubcommand.class, 9 | GlossaryUploadSubcommand.class, 10 | GlossaryDownloadSubcommand.class 11 | } 12 | ) 13 | class GlossarySubcommand extends HelpCommand { 14 | @Override 15 | protected CommandLine getCommand(CommandLine rootCommand) { 16 | return rootCommand.getSubcommands().get(CommandNames.GLOSSARY); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/LabelSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.LABEL, 7 | subcommands = { 8 | LabelListSubcommand.class, 9 | LabelAddSubcommand.class, 10 | LabelDeleteSubcommand.class 11 | } 12 | ) 13 | class LabelSubcommand extends HelpCommand { 14 | 15 | @Override 16 | protected CommandLine getCommand(CommandLine rootCommand) { 17 | return rootCommand.getSubcommands().get(CommandNames.LABEL); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/DistributionListSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.anyBoolean; 6 | import static org.mockito.Mockito.verify; 7 | 8 | public class DistributionListSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testDistributionList() { 12 | this.execute(CommandNames.DISTRIBUTION, CommandNames.LIST); 13 | verify(actionsMock) 14 | .distributionList(anyBoolean()); 15 | this.check(true); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/utils/AssertUtils.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.utils; 2 | 3 | import java.io.File; 4 | 5 | import static org.hamcrest.MatcherAssert.assertThat; 6 | import static org.hamcrest.Matchers.equalTo; 7 | 8 | 9 | public class AssertUtils { 10 | 11 | public static void assertPathsEqualIgnoringSeparator(String actual, String expected) { 12 | actual = actual.replace("/", File.separator).replace("\\", File.separator); 13 | expected = expected.replace("/", File.separator).replace("\\", File.separator); 14 | assertThat(actual, equalTo(expected)); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /website/README.md: -------------------------------------------------------------------------------- 1 | # Website 2 | 3 | This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator. 4 | 5 | ### Installation 6 | 7 | ``` 8 | $ npm i 9 | ``` 10 | 11 | ### Local Development 12 | 13 | ``` 14 | $ npm start 15 | ``` 16 | 17 | This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. 18 | 19 | ### Build 20 | 21 | ``` 22 | $ npm run build 23 | ``` 24 | 25 | This command generates static content into the `build` directory and can be served using any static contents hosting service. 26 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/StringSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.STRING, 7 | subcommands = { 8 | StringListSubcommand.class, 9 | StringAddSubcommand.class, 10 | StringDeleteSubcommand.class, 11 | StringEditSubcommand.class 12 | } 13 | ) 14 | class StringSubcommand extends HelpCommand { 15 | @Override 16 | protected CommandLine getCommand(CommandLine rootCommand) { 17 | return rootCommand.getSubcommands().get(CommandNames.STRING); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ApplicationSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.APP, 7 | subcommands = { 8 | AppListSubcommand.class, 9 | AppInstallSubcommand.class, 10 | AppUninstallSubcommand.class 11 | } 12 | ) 13 | class ApplicationSubcommand extends HelpCommand { 14 | 15 | @Override 16 | protected CommandLine getCommand(CommandLine rootCommand) { 17 | return rootCommand.getSubcommands().get(CommandNames.APP); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin 3 | 4 | == crowdin 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/WorkWithProjectTestPart.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli; 2 | 3 | import com.crowdin.cli.commands.functionality.PropertiesBuilderTest; 4 | import com.crowdin.cli.properties.helper.TempProject; 5 | import org.junit.jupiter.api.AfterEach; 6 | import org.junit.jupiter.api.BeforeEach; 7 | 8 | public class WorkWithProjectTestPart { 9 | 10 | protected TempProject tempProject; 11 | 12 | @BeforeEach 13 | public void initFolder() { 14 | tempProject = new TempProject(PropertiesBuilderTest.class); 15 | } 16 | 17 | @AfterEach 18 | public void removeFolder() { 19 | tempProject.delete(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/BundleListSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | public class BundleListSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testBundleList() { 13 | this.execute(CommandNames.BUNDLE, CommandNames.LIST); 14 | verify(actionsMock) 15 | .bundleList(anyBoolean(), anyBoolean()); 16 | this.check(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ScreenshotSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | import picocli.CommandLine.Command; 5 | 6 | @Command( 7 | name = CommandNames.SCREENSHOT, 8 | subcommands = { 9 | ScreenshotListSubcommand.class, 10 | ScreenshotUploadSubcommand.class, 11 | ScreenshotDeleteSubcommand.class 12 | } 13 | ) 14 | class ScreenshotSubcommand extends HelpCommand { 15 | 16 | @Override 17 | protected CommandLine getCommand(CommandLine rootCommand) { 18 | return rootCommand.getSubcommands().get(CommandNames.SCREENSHOT); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/BranchCloneSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | class BranchCloneSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testBranchClone() { 13 | this.execute(CommandNames.BRANCH, CommandNames.CLONE, "main", "clone"); 14 | verify(actionsMock).branchClone(any(), any(), anyBoolean(), anyBoolean()); 15 | this.check(true); 16 | } 17 | } -------------------------------------------------------------------------------- /website/mantemplates/crowdin-app.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-app 3 | 4 | == crowdin app 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/FileSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | import picocli.CommandLine.Command; 5 | 6 | @Command( 7 | name = CommandNames.FILE, 8 | subcommands = { 9 | FileListSubcommand.class, 10 | FileUploadSubcommand.class, 11 | FileDownloadSubcommand.class, 12 | FileDeleteSubcommand.class 13 | } 14 | ) 15 | class FileSubcommand extends HelpCommand { 16 | 17 | @Override 18 | protected CommandLine getCommand(CommandLine rootCommand) { 19 | return rootCommand.getSubcommands().get(CommandNames.FILE); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/InitSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | public class InitSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testGenerate() { 13 | this.execute(CommandNames.INIT); 14 | verify(actionsMock) 15 | .init(any(), any(), any(), any(), any(), any(), any(), any(), any(), anyBoolean()); 16 | this.check(false); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/ScreenshotListSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | public class ScreenshotListSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testScreenshotList() { 13 | this.execute(CommandNames.SCREENSHOT, CommandNames.LIST); 14 | verify(actionsMock).screenshotList(any(), anyBoolean()); 15 | this.check(true); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-file.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-file 3 | 4 | == crowdin file 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-task.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-task 3 | 4 | == crowdin task 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/properties/BaseParams.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.properties; 2 | 3 | import lombok.Data; 4 | import picocli.CommandLine; 5 | 6 | @Data 7 | public class BaseParams implements Params { 8 | 9 | @CommandLine.Option(names = {"-T", "--token"}, paramLabel = "...", descriptionKey = "params.token") 10 | private String tokenParam; 11 | 12 | @CommandLine.Option(names = {"--base-url"}, paramLabel = "...", descriptionKey = "params.base-url") 13 | private String baseUrlParam; 14 | 15 | @CommandLine.Option(names = {"--base-path"}, paramLabel = "...", descriptionKey = "params.base-path") 16 | private String basePathParam; 17 | } 18 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-branch.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-branch 3 | 4 | == crowdin branch 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-config.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-config 3 | 4 | == crowdin config 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-status.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-status 3 | 4 | == crowdin status 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-string.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-string 3 | 4 | == crowdin string 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-upload.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-upload 3 | 4 | == crowdin upload 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-app-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-app-list 3 | 4 | == crowdin app list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-comment.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-comment 3 | 4 | == crowdin comment 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-language.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-language 3 | 4 | == crowdin language 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-project.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-project 3 | 4 | == crowdin project 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-task-add.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-task-add 3 | 4 | == crowdin task add 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-tm-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-tm-list 3 | 4 | == crowdin tm list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-file-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-file-list 3 | 4 | == crowdin file list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-task-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-task-list 3 | 4 | == crowdin task list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/functionality/FilesInterface.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.functionality; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.util.List; 7 | 8 | public interface FilesInterface { 9 | 10 | void writeToFile(String file, InputStream data) throws IOException; 11 | 12 | void copyFile(File fromFile, File toFile); 13 | 14 | List extractZipArchive(File zipArchive, File dir); 15 | 16 | List zipArchiveContent(File zipArchive); 17 | 18 | void deleteFile(File file) throws IOException; 19 | 20 | void deleteDirectory(File dir) throws IOException; 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/CommentListSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | public class CommentListSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testCommentList() { 13 | this.execute(CommandNames.COMMENT, CommandNames.LIST); 14 | verify(actionsMock) 15 | .commentList(anyBoolean(), anyBoolean(), any(), any(), any(), any()); 16 | this.check(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/FileListSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | public class FileListSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testListProject() { 13 | this.execute(CommandNames.FILE, CommandNames.LIST); 14 | verify(actionsMock) 15 | .listFiles(anyBoolean(), any(), anyBoolean(), anyBoolean(), anyBoolean()); 16 | this.check(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-app-install.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-app-install 3 | 4 | == crowdin app install 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-branch-add.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-branch-add 3 | 4 | == crowdin branch add 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-branch-edit.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-branch-edit 3 | 4 | == crowdin branch edit 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-branch-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-branch-list 3 | 4 | == crowdin branch list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-comment-add.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-comment-add 3 | 4 | == crowdin comment add 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-config-lint.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-config-lint 3 | 4 | == crowdin config lint 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-file-delete.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-file-delete 3 | 4 | == crowdin file delete 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-label.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-label 3 | 4 | == crowdin label 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-project-add.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-project-add 3 | 4 | == crowdin project add 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-string-edit.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-string-edit 3 | 4 | == crowdin string edit 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-tm-download.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-tm-download 3 | 4 | == crowdin tm download 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/DistributionSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.DISTRIBUTION, 7 | subcommands = { 8 | DistributionAddSubcommand.class, 9 | DistributionListSubcommand.class, 10 | DistributionEditSubcommand.class, 11 | DistributionReleaseSubcommand.class 12 | } 13 | ) 14 | class DistributionSubcommand extends HelpCommand { 15 | 16 | @Override 17 | protected CommandLine getCommand(CommandLine rootCommand) { 18 | return rootCommand.getSubcommands().get(CommandNames.DISTRIBUTION); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/BranchMergeSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | class BranchMergeSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testBranchMerge() { 13 | this.execute(CommandNames.BRANCH, CommandNames.BRANCH_MERGE, "main", "dev"); 14 | verify(actionsMock).branchMerge(any(), any(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean()); 15 | this.check(true); 16 | } 17 | } -------------------------------------------------------------------------------- /website/mantemplates/crowdin-app-uninstall.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-app-uninstall 3 | 4 | == crowdin app uninstall 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-branch-delete.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-branch-delete 3 | 4 | == crowdin branch delete 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-comment-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-comment-list 3 | 4 | == crowdin comment list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-distribution.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-distribution 3 | 4 | == crowdin distribution 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-file-download.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-file-download 3 | 4 | == crowdin file download 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-glossary-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-glossary-list 3 | 4 | == crowdin glossary list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-language-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-language-list 3 | 4 | == crowdin language list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-project-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-project-list 3 | 4 | == crowdin project list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-string-delete.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-string-delete 3 | 4 | == crowdin string delete 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-config-sources.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-config-sources 3 | 4 | == crowdin config sources 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-label-add.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-label-add 3 | 4 | == crowdin label add 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-project-browse.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-project-browse 3 | 4 | == crowdin project browse 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-upload-sources.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-upload-sources 3 | 4 | == crowdin upload sources 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/TaskListSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.client.tasks.model.Status; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import static org.mockito.ArgumentMatchers.*; 7 | import static org.mockito.ArgumentMatchers.any; 8 | import static org.mockito.Mockito.verify; 9 | 10 | public class TaskListSubcommandTest extends PicocliTestUtils { 11 | 12 | @Test 13 | public void testTaskList() { 14 | this.execute(CommandNames.TASK, CommandNames.LIST); 15 | verify(actionsMock) 16 | .taskList(anyBoolean(), anyBoolean(), any(), any()); 17 | this.check(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-comment-resolve.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-comment-resolve 3 | 4 | == crowdin comment resolve 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-screenshot.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-screenshot 3 | 4 | == crowdin screenshot 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /.github/workflows/bump-version.yml: -------------------------------------------------------------------------------- 1 | name: Bump Version 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | version: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v4 11 | with: 12 | fetch-depth: 0 13 | persist-credentials: false 14 | 15 | - uses: actions/setup-node@v4 16 | with: 17 | node-version: 22 18 | cache: 'npm' 19 | 20 | - name: Install dependencies 21 | run: npm install 22 | 23 | - name: Bump version 24 | env: 25 | GITHUB_TOKEN: ${{ secrets.RELEASE_GH_TOKEN }} 26 | run: | 27 | npx semantic-release 28 | npx semantic-release --version 29 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/BundleCloneSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | class BundleCloneSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testBundleClone() { 13 | this.execute(CommandNames.BUNDLE, CommandNames.CLONE, "1"); 14 | verify(actionsMock) 15 | .bundleClone(any(), any(), any(), any(), any(), any(), any(), anyBoolean(), any(), any(), any()); 16 | this.check(true); 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/ConfigSourcesSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | public class ConfigSourcesSubcommandTest extends PicocliTestUtils { 10 | 11 | 12 | @Test 13 | public void testListSources() { 14 | this.execute(CommandNames.CONFIG, CommandNames.SOURCES); 15 | verify(actionsMock) 16 | .listSources(anyBoolean(), any(), anyBoolean(), anyBoolean(), anyBoolean()); 17 | this.check(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/ConfigTranslationsSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.anyBoolean; 6 | import static org.mockito.Mockito.verify; 7 | 8 | public class ConfigTranslationsSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testListTranslations() { 12 | this.execute(CommandNames.CONFIG, CommandNames.TRANSLATIONS); 13 | verify(actionsMock) 14 | .listTranslations(anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean()); 15 | this.check(true); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-distribution-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-distribution-list 3 | 4 | == crowdin distribution list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-glossary-download.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-glossary-download 3 | 4 | == crowdin glossary download 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-label-delete.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-label-delete 3 | 4 | == crowdin label delete 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-status-translation.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-status-translation 3 | 4 | == crowdin status translation 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-config-translations.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-config-translations 3 | 4 | == crowdin config translations 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-status-proofreading.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-status-proofreading 3 | 4 | == crowdin status proofreading 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-distribution-release.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-distribution-release 3 | 4 | == crowdin distribution release 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-screenshot-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-screenshot-list 3 | 4 | == crowdin screenshot list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: Enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/BranchSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.BRANCH, 7 | subcommands = { 8 | BranchAddSubcommand.class, 9 | BranchCloneSubcommand.class, 10 | BranchDeleteSubcommand.class, 11 | BranchListSubcommand.class, 12 | BranchMergeSubcommand.class, 13 | BranchEditSubcommand.class 14 | } 15 | ) 16 | class BranchSubcommand extends HelpCommand { 17 | @Override 18 | protected CommandLine getCommand(CommandLine rootCommand) { 19 | return rootCommand.getSubcommands().get(CommandNames.BRANCH); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-screenshot-delete.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-screenshot-delete 3 | 4 | == crowdin screenshot delete 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-screenshot-upload.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-screenshot-upload 3 | 4 | == crowdin screenshot upload 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/FileDeleteSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.Mockito.verify; 7 | 8 | class FileDeleteSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testFileDelete() { 12 | this.execute(CommandNames.FILE, CommandNames.DELETE, "file.txt"); 13 | verify(actionsMock).fileDelete(any(), any()); 14 | this.check(true); 15 | } 16 | 17 | @Test 18 | public void testFileDeleteInvalidOptions() { 19 | this.executeInvalidParams(CommandNames.FILE, CommandNames.DELETE); 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/BundleSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = CommandNames.BUNDLE, 7 | subcommands = { 8 | BundleListSubcommand.class, 9 | BundleAddSubcommand.class, 10 | BundleDeleteSubcommand.class, 11 | BundleDownloadSubcommand.class, 12 | BundleCloneSubcommand.class, 13 | BundleBrowseSubcommand.class 14 | } 15 | ) 16 | class BundleSubcommand extends HelpCommand { 17 | 18 | @Override 19 | protected CommandLine getCommand(CommandLine rootCommand) { 20 | return rootCommand.getSubcommands().get(CommandNames.BUNDLE); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/BundleBrowseSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.Mockito.verify; 7 | 8 | public class BundleBrowseSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testBundleBrowseInvalidOptions() { 12 | this.executeInvalidParams(CommandNames.BUNDLE, CommandNames.BROWSE); 13 | } 14 | 15 | @Test 16 | public void testProjectBrowse() { 17 | this.execute(CommandNames.BUNDLE, CommandNames.BROWSE, "1"); 18 | verify(actionsMock).bundleBrowse(any()); 19 | this.check(true); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/StatusSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.ArgumentMatchers.eq; 8 | import static org.mockito.Mockito.verify; 9 | 10 | public class StatusSubcommandTest extends PicocliTestUtils { 11 | 12 | @Test 13 | public void testStatus() { 14 | this.execute(CommandNames.STATUS); 15 | verify(actionsMock) 16 | .status(anyBoolean(), any(), any(), any(), any(), anyBoolean(), eq(true), eq(true), anyBoolean(), anyBoolean()); 17 | this.check(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/LabelDeleteSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.Mockito.verify; 7 | 8 | class LabelDeleteSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testLabelDelete() { 12 | this.execute(CommandNames.LABEL, CommandNames.DELETE, "label"); 13 | verify(actionsMock).labelDelete(any()); 14 | this.check(true); 15 | } 16 | 17 | @Test 18 | public void testLabelDeleteInvalidOptions() { 19 | this.executeInvalidParams(CommandNames.LABEL, CommandNames.DELETE); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/PreTranslateSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | class PreTranslateSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testPreTranslate() { 13 | this.execute(CommandNames.PRE_TRANSLATE, "--method", "TM"); 14 | verify(actionsMock) 15 | .preTranslate(any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), anyBoolean(), anyBoolean(), any(), any(), anyBoolean()); 16 | this.check(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: Bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Configuration file: '...' 16 | 2. Execute CLI command: '...' 17 | 3. See an error 18 | 19 | **Expected behavior** 20 | A clear and concise description of what you expected to happen. 21 | 22 | **Environment:** 23 | - OS: [e.g. Ubuntu] 24 | - Version [e.g. 18.04] 25 | 26 | **Screenshots** 27 | If applicable, add screenshots to help explain your problem. 28 | 29 | **Additional context** 30 | Add any other context about the problem here. 31 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/ClientScreenshot.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | import com.crowdin.client.screenshots.model.*; 4 | 5 | import java.util.List; 6 | 7 | public interface ClientScreenshot extends Client { 8 | 9 | List listScreenshots(Long stringId); 10 | 11 | List listScreenshotsByName(String fileName); 12 | 13 | Screenshot getScreenshot(Long id); 14 | 15 | Screenshot uploadScreenshot(AddScreenshotRequest request) throws ResponseException; 16 | 17 | Screenshot updateScreenshot(Long screenshotId, UpdateScreenshotRequest request); 18 | 19 | void deleteScreenshot(Long id); 20 | 21 | void replaceTags(Long screenshotId, AutoTagReplaceTagsRequest request); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/CommentResolveSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientComment; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | name = CommandNames.COMMENT_RESOLVE 11 | ) 12 | class CommentResolveSubcommand extends ActCommandComment { 13 | 14 | @CommandLine.Parameters(descriptionKey = "crowdin.comment.resolve.id") 15 | protected Long id; 16 | 17 | @Override 18 | protected NewAction getAction(Actions actions) { 19 | return actions.resolve(id); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-glossary.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-glossary 3 | 4 | == crowdin glossary 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === See also 19 | 20 | * link:https://support.crowdin.com/glossary/[Glossary Management] 21 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-tm.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-tm 3 | 4 | == crowdin tm 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === See also 19 | 20 | * link:https://support.crowdin.com/translation-memory/[Translation Memory Management] 21 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/ScreenshotDeleteSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.Mockito.verify; 7 | 8 | public class ScreenshotDeleteSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testScreenshotDelete() { 12 | this.execute(CommandNames.SCREENSHOT, CommandNames.DELETE, "123"); 13 | verify(actionsMock).screenshotDelete(any()); 14 | this.check(true); 15 | } 16 | 17 | @Test 18 | public void testScreenshotDeleteInvalidOptions() { 19 | this.executeInvalidParams(CommandNames.SCREENSHOT, CommandNames.DELETE); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/actions/ProjectBrowseAction.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.actions; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.NewAction; 5 | import com.crowdin.cli.commands.Outputter; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | 8 | import java.awt.*; 9 | import java.net.URI; 10 | 11 | class ProjectBrowseAction implements NewAction { 12 | 13 | @Override 14 | public void act(Outputter out, ProjectProperties pb, ProjectClient client) { 15 | try { 16 | Desktop.getDesktop().browse(new URI(client.getProjectUrl())); 17 | } catch (Exception e) { 18 | throw new RuntimeException("Unexpected error"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ScreenshotDeleteSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientScreenshot; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | name = CommandNames.DELETE 11 | ) 12 | class ScreenshotDeleteSubcommand extends ActCommandScreenshot { 13 | 14 | @CommandLine.Parameters(descriptionKey = "crowdin.screenshot.delete.id") 15 | protected Long id; 16 | 17 | @Override 18 | protected NewAction getAction(Actions actions) { 19 | return actions.screenshotDelete(id); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/Outputter.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands; 2 | 3 | public interface Outputter { 4 | 5 | void println(String string); 6 | 7 | void print(String string); 8 | 9 | String format(String string); 10 | 11 | static Outputter getDefault() { 12 | return new Outputter() { 13 | @Override 14 | public void println(String string) { 15 | System.out.println(string); 16 | } 17 | 18 | @Override 19 | public void print(String string) { 20 | System.out.print(string); 21 | } 22 | 23 | @Override 24 | public String format(String string) { 25 | return string; 26 | } 27 | }; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/StringDeleteSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | name = CommandNames.DELETE, 11 | sortOptions = false 12 | ) 13 | class StringDeleteSubcommand extends ActCommandProject { 14 | 15 | @CommandLine.Parameters(descriptionKey = "crowdin.string.delete.id") 16 | protected Long id; 17 | 18 | @Override 19 | protected NewAction getAction(Actions actions) { 20 | return actions.stringDelete(id); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: CodeQL Analysis 2 | 3 | on: 4 | schedule: 5 | - cron: '0 8 * * 0' # https://crontab.guru/#0_8_*_*_0 6 | workflow_dispatch: 7 | 8 | jobs: 9 | codeql: 10 | name: CodeQL Analyze 11 | runs-on: ubuntu-latest 12 | permissions: 13 | actions: read 14 | contents: read 15 | security-events: write 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - name: Initialize CodeQL 20 | uses: github/codeql-action/init@v3 21 | with: 22 | languages: java 23 | 24 | - name: Autobuild 25 | uses: github/codeql-action/autobuild@v3 26 | 27 | - name: Perform CodeQL Analysis 28 | uses: github/codeql-action/analyze@v3 29 | with: 30 | category: "/language:java" 31 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/BranchDeleteSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | sortOptions = false, 11 | name = CommandNames.DELETE 12 | ) 13 | class BranchDeleteSubcommand extends ActCommandProject { 14 | 15 | @CommandLine.Parameters(descriptionKey = "crowdin.branch.delete.name") 16 | protected String name; 17 | 18 | @Override 19 | protected NewAction getAction(Actions actions) { 20 | return actions.branchDelete(name); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/LabelAddSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | class LabelAddSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testLabelAdd() { 13 | this.execute(CommandNames.LABEL, CommandNames.ADD, "label"); 14 | verify(actionsMock).labelAdd(any(), anyBoolean()); 15 | this.check(true); 16 | } 17 | 18 | @Test 19 | public void testLabelAddInvalidOptions() { 20 | this.executeInvalidParams(CommandNames.LABEL, CommandNames.ADD); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/StatusProofreadingSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.ArgumentMatchers.eq; 8 | import static org.mockito.Mockito.verify; 9 | 10 | public class StatusProofreadingSubcommandTest extends PicocliTestUtils { 11 | 12 | @Test 13 | public void testStatusProofreading() { 14 | this.execute(CommandNames.STATUS, CommandNames.STATUS_PROOFREADING); 15 | verify(actionsMock) 16 | .status(anyBoolean(), any(), any(), any(), any(), anyBoolean(), eq(false), eq(true), eq(false), anyBoolean()); 17 | this.check(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/StatusTranslationsSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.ArgumentMatchers.eq; 8 | import static org.mockito.Mockito.verify; 9 | 10 | public class StatusTranslationsSubcommandTest extends PicocliTestUtils { 11 | 12 | @Test 13 | public void testStatusTranslations() { 14 | this.execute(CommandNames.STATUS, CommandNames.STATUS_TRANSLATION); 15 | verify(actionsMock) 16 | .status(anyBoolean(), any(), any(), any(), any(), anyBoolean(), eq(true), eq(false), eq(false), anyBoolean()); 17 | this.check(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/LabelDeleteSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientLabel; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | sortOptions = false, 11 | name = CommandNames.DELETE 12 | ) 13 | public class LabelDeleteSubcommand extends ActCommandLabel { 14 | 15 | @CommandLine.Parameters(descriptionKey = "crowdin.label.title") 16 | protected String title; 17 | 18 | @Override 19 | protected NewAction getAction(Actions actions) { 20 | return actions.labelDelete(title); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/StringDeleteSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | public class StringDeleteSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testStringDelete() { 13 | this.execute(CommandNames.STRING, CommandNames.DELETE, "42"); 14 | verify(actionsMock) 15 | .stringDelete(any()); 16 | this.check(true); 17 | } 18 | 19 | @Test 20 | public void testStringDeleteInvalidOptions() { 21 | this.executeInvalidParams(CommandNames.STRING, CommandNames.DELETE); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-file-upload.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-file-upload 3 | 4 | == crowdin file upload 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === See also 19 | 20 | * link:https://developer.crowdin.com/api/v2/#operation/api.projects.files.post[List of file types] 21 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/AppInstallSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | sortOptions = false, 11 | name = CommandNames.INSTALL 12 | ) 13 | class AppInstallSubcommand extends ActCommandProject { 14 | 15 | @CommandLine.Parameters(descriptionKey = "crowdin.app.install.identifier") 16 | protected String identifier; 17 | 18 | @Override 19 | protected NewAction getAction(Actions actions) { 20 | return actions.installApp(identifier); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/utils/console/ExecutionStatus.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.utils.console; 2 | 3 | import com.crowdin.cli.utils.Utils; 4 | 5 | public enum ExecutionStatus { 6 | 7 | OK("[OK] ", "✔️ "), 8 | ERROR("[ERROR] ", "\u274C "), 9 | WARNING("[WARNING] ", "⚠️ "), 10 | SKIPPED("[SKIPPED] ", "\u23ED "), 11 | EMPTY("", ""); 12 | 13 | private String windowsIcon; 14 | private String unixIcon; 15 | 16 | ExecutionStatus(String windowsIcon, String unixIcon) { 17 | this.windowsIcon = windowsIcon; 18 | this.unixIcon = unixIcon; 19 | } 20 | 21 | public String getIcon() { 22 | return Utils.isWindows() ? windowsIcon : unixIcon; 23 | } 24 | 25 | public String withIcon(String message) { 26 | return getIcon() + message; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/ClientBundle.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | import com.crowdin.client.bundles.model.AddBundleRequest; 4 | import com.crowdin.client.bundles.model.Bundle; 5 | import com.crowdin.client.bundles.model.BundleExport; 6 | 7 | import java.net.URL; 8 | import java.util.List; 9 | 10 | public interface ClientBundle extends Client { 11 | 12 | List listBundle(); 13 | 14 | Bundle addBundle(AddBundleRequest addBundleRequest); 15 | 16 | Bundle getBundle(Long id); 17 | 18 | void deleteBundle(Long bundleId); 19 | 20 | URL downloadBundle(Long id, String exportId); 21 | 22 | BundleExport startExportingBundle(Long id) throws ResponseException; 23 | 24 | BundleExport checkExportingBundle(Long tmId, String exportId); 25 | 26 | String getBundleUrl(Long bundleId); 27 | } 28 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-branch-clone.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-branch-clone 3 | 4 | == crowdin branch clone 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === Notes 19 | 20 | - This command is only available for link:https://support.crowdin.com/creating-project/#project-types[string-based] projects. 21 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-branch-merge.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-branch-merge 3 | 4 | == crowdin branch merge 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === Notes 19 | 20 | - This command is only available for link:https://support.crowdin.com/creating-project/#project-types[string-based] projects. 21 | -------------------------------------------------------------------------------- /packages/chocolatey/tools/chocolateyinstall.ps1: -------------------------------------------------------------------------------- 1 | $ErrorActionPreference = 'Stop'; # stop on all errors 2 | $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" 3 | 4 | $packageName = $env:ChocolateyPackageName 5 | $packageVersion = $env:ChocolateyPackageVersion 6 | $packageArgs = @{ 7 | packageName = $packageName 8 | unzipLocation = $toolsDir 9 | url = 'https://github.com/crowdin/crowdin-cli/releases/download/4.12.0/crowdin-cli.zip' 10 | checksum = '820f5c04dd0de0a1875ba8b9eae3b9f9413560914c6b6690f27255f093d2be65' 11 | checksumType = 'sha256' 12 | } 13 | Install-ChocolateyZipPackage @packageArgs 14 | 15 | $unzipDir = Join-Path $toolsDir $packageVersion 16 | Install-ChocolateyEnvironmentVariable -variableName "CROWDIN_HOME" -variableValue "$unzipDir" 17 | Add-BinFile -name crowdin -path "$unzipDir\crowdin.bat" 18 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/LabelListSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientLabel; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | sortOptions = false, 11 | name = CommandNames.LIST 12 | ) 13 | class LabelListSubcommand extends ActCommandLabel { 14 | 15 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 16 | protected boolean plainView; 17 | 18 | @Override 19 | protected NewAction getAction(Actions actions) { 20 | return actions.labelList(this.plainView, this.isVerbose); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/ProjectAddSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | class ProjectAddSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testProjectAddInvalidOptions() { 13 | this.executeInvalidParams(CommandNames.PROJECT, CommandNames.ADD); 14 | } 15 | 16 | @Test 17 | public void testProjectAdd() { 18 | this.execute(CommandNames.PROJECT, CommandNames.ADD, "name", "--language", "uk"); 19 | verify(actionsMock).projectAdd(any(), anyBoolean(), any(), any(), anyBoolean(), anyBoolean()); 20 | this.check(true); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-bundle-browse.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-bundle-browse 3 | 4 | == crowdin bundle browse 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === See also 19 | 20 | * link:https://support.crowdin.com/bundles/[Target File Bundles] 21 | * link:/crowdin-cli/commands/crowdin-bundle[`crowdin bundle` command] 22 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-bundle.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-bundle 3 | 4 | == crowdin bundle 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === See also 19 | 20 | * link:https://support.crowdin.com/bundles/[Target File Bundles] 21 | * link:/crowdin-cli/commands/crowdin-bundle-download[`crowdin bundle download` command] 22 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-distribution-edit.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-distribution-edit 3 | 4 | == crowdin distribution edit 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | See the link:/crowdin-cli/commands/crowdin-distribution-list[`crowdin distribution list` command] to get the list of distributions including their hashes. 19 | -------------------------------------------------------------------------------- /snapcraft.yaml: -------------------------------------------------------------------------------- 1 | name: crowdin 2 | summary: The Crowdin CLI 3 | description: | 4 | Crowdin CLI is a command line tool that allows you to manage and synchronize your localization resources with your Crowdin project. Using CLI, you can: 5 | 6 | - automate the process of updating your source files in your Crowdin project 7 | - download translations from Crowdin and automatically save them in the correct locations 8 | - upload all your existing translations to Crowdin in minutes 9 | - manage your localization resources without leaving the terminal 10 | - integrate Crowdin CLI with GitHub, GitLab, Jenkins, CircleCI, and other software 11 | 12 | ## Usage 13 | 14 | Visit the [documentation](https://crowdin.github.io/crowdin-cli/) for more details. 15 | 16 | adopt-info: crowdin 17 | grade: stable 18 | confinement: strict # classic 19 | base: core18 20 | license: MIT 21 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/MockitoUtils.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.net.URL; 6 | 7 | public class MockitoUtils { 8 | 9 | public static URL getMockUrl(Class clazz) { 10 | try { 11 | return new URL("file://" + clazz.getProtectionDomain().getCodeSource().getLocation().getPath()); 12 | } catch (IOException e) { 13 | throw new RuntimeException("Couldn't mock url", e); 14 | } 15 | } 16 | 17 | public static File getResourceFile(String path, Class clazz) { 18 | URL fileUrl = clazz.getClassLoader().getResource(path); 19 | if (fileUrl == null) { 20 | throw new RuntimeException("Couldn't retrieve resource file from path: " + path); 21 | } 22 | return new File(fileUrl.getFile()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-bundle-add.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-bundle-add 3 | 4 | == crowdin bundle add 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === See also 19 | 20 | * link:https://support.crowdin.com/bundles/[Target File Bundles] 21 | * link:/crowdin-cli/commands/crowdin-bundle-download[`crowdin bundle download` command] 22 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-bundle-download.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-bundle-download 3 | 4 | == crowdin bundle download 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === See also 19 | 20 | * link:https://support.crowdin.com/bundles/[Target File Bundles] 21 | * link:/crowdin-cli/commands/crowdin-bundle[`crowdin bundle` command] 22 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/actions/BundleBrowseAction.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.actions; 2 | 3 | import com.crowdin.cli.client.ClientBundle; 4 | import com.crowdin.cli.commands.NewAction; 5 | import com.crowdin.cli.commands.Outputter; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import lombok.AllArgsConstructor; 8 | 9 | import java.awt.*; 10 | import java.net.URI; 11 | 12 | @AllArgsConstructor 13 | class BundleBrowseAction implements NewAction { 14 | 15 | Long id; 16 | 17 | @Override 18 | public void act(Outputter out, ProjectProperties pb, ClientBundle client) { 19 | try { 20 | Desktop.getDesktop().browse(new URI(client.getBundleUrl(id))); 21 | } catch (Exception e) { 22 | throw new RuntimeException("Unexpected error"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-bundle-list.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-bundle-list 3 | 4 | == crowdin bundle list 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === See also 19 | 20 | * link:https://support.crowdin.com/bundles/[Target File Bundles] 21 | * link:/crowdin-cli/commands/crowdin-bundle-download[`crowdin bundle download` command] 22 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-bundle-delete.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-bundle-delete 3 | 4 | == crowdin bundle delete 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === See also 19 | 20 | * link:https://support.crowdin.com/bundles/[Target File Bundles] 21 | * link:/crowdin-cli/commands/crowdin-bundle-download[`crowdin bundle download` command] 22 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/TmListSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientTm; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.BaseProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | name = CommandNames.LIST 11 | ) 12 | class TmListSubcommand extends ActCommandTm { 13 | 14 | @Override 15 | protected NewAction getAction(Actions actions) { 16 | return actions.tmList(this.plainView); 17 | } 18 | 19 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 20 | protected boolean plainView; 21 | 22 | @Override 23 | protected boolean isAnsi() { 24 | return super.isAnsi() && !plainView; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/BundleBrowseSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientBundle; 4 | import com.crowdin.cli.client.ProjectClient; 5 | import com.crowdin.cli.commands.Actions; 6 | import com.crowdin.cli.commands.NewAction; 7 | import com.crowdin.cli.commands.Outputter; 8 | import com.crowdin.cli.properties.ProjectProperties; 9 | import picocli.CommandLine; 10 | 11 | @CommandLine.Command( 12 | name = CommandNames.BROWSE, 13 | sortOptions = false 14 | ) 15 | class BundleBrowseSubcommand extends ActCommandBundle { 16 | 17 | @CommandLine.Parameters(descriptionKey = "crowdin.bundle.browse.id") 18 | protected Long id; 19 | 20 | @Override 21 | protected NewAction getAction(Actions actions) { 22 | return actions.bundleBrowse(id); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ProjectBrowseSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import com.crowdin.cli.utils.Utils; 8 | import org.apache.commons.lang3.StringUtils; 9 | import picocli.CommandLine; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import static java.util.Objects.nonNull; 15 | 16 | @CommandLine.Command( 17 | name = CommandNames.BROWSE, 18 | sortOptions = false 19 | ) 20 | class ProjectBrowseSubcommand extends ActCommandProject { 21 | 22 | @Override 23 | protected NewAction getAction(Actions actions) { 24 | return actions.projectBrowse(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/utils/tree/DrawTree.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.utils.tree; 2 | 3 | import com.crowdin.cli.commands.picocli.ExitCodeExceptionMapper; 4 | import com.crowdin.cli.utils.Utils; 5 | 6 | import java.util.List; 7 | 8 | public class DrawTree { 9 | 10 | public static List draw(List l) { 11 | if (l == null) { 12 | throw new NullPointerException("NPE in DrawTree.draw"); 13 | } 14 | 15 | Tree top = new Tree<>("."); 16 | Tree current = top; 17 | 18 | for (String tree : l) { 19 | Tree root = current; 20 | for (String data : tree.split(Utils.PATH_SEPARATOR_REGEX)) { 21 | current = current.child(data); 22 | } 23 | current = root; 24 | } 25 | return top.accept(new PrintIndentedVisitor()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ProjectListSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import com.crowdin.cli.utils.Utils; 8 | import org.apache.commons.lang3.StringUtils; 9 | import picocli.CommandLine; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import static java.util.Objects.nonNull; 15 | 16 | @CommandLine.Command( 17 | name = CommandNames.LIST, 18 | sortOptions = false 19 | ) 20 | class ProjectListSubcommand extends ActCommandProject { 21 | 22 | @Override 23 | protected NewAction getAction(Actions actions) { 24 | return actions.projectList(this.isVerbose); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/HelpCommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | import java.io.PrintStream; 6 | 7 | public abstract class HelpCommand extends GenericCommand { 8 | 9 | private static PrintStream stream; 10 | private static CommandLine.Help.ColorScheme colorScheme; 11 | private static CommandLine rootCommand; 12 | 13 | public static void setOptions(CommandLine rootCommand, PrintStream stream, CommandLine.Help.ColorScheme colorScheme) { 14 | HelpCommand.rootCommand = rootCommand; 15 | HelpCommand.stream = stream; 16 | HelpCommand.colorScheme = colorScheme; 17 | } 18 | 19 | @Override 20 | public final void run() { 21 | getCommand(rootCommand).usage(stream, colorScheme); 22 | } 23 | 24 | protected abstract CommandLine getCommand(CommandLine rootCommand); 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/functionality/BranchUtilsTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.functionality; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; 6 | 7 | public class BranchUtilsTest { 8 | 9 | @Test 10 | public void testNormalizeBranchName() { 11 | assertEquals(BranchUtils.normalizeBranchName("main|1>2"), "main.1.2"); 12 | assertEquals(BranchUtils.normalizeBranchName("dev/1"), "dev.1"); 13 | assertEquals(BranchUtils.normalizeBranchName("dev\\1"), "dev.1"); 14 | assertEquals(BranchUtils.normalizeBranchName("feat:123?"), "feat.123."); 15 | assertEquals(BranchUtils.normalizeBranchName("base*"), "base."); 16 | assertEquals(BranchUtils.normalizeBranchName("test?\""), "test.."); 17 | assertEquals(BranchUtils.normalizeBranchName("test<"), "test."); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/AppUninstallSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.anyBoolean; 6 | import static org.mockito.Mockito.verify; 7 | 8 | public class AppUninstallSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testAppUninstall() { 12 | var appId = "test-app"; 13 | this.execute(CommandNames.APP, CommandNames.UNINSTALL, appId); 14 | verify(actionsMock).uninstallApp(appId, false); 15 | this.check(true); 16 | } 17 | 18 | @Test 19 | public void testAppUninstallForce() { 20 | var appId = "test-app"; 21 | this.execute(CommandNames.APP, CommandNames.UNINSTALL, appId, "--force"); 22 | verify(actionsMock).uninstallApp(appId, true); 23 | this.check(true); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/ClientDistribution.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | import com.crowdin.client.core.model.PatchRequest; 4 | import com.crowdin.client.distributions.model.*; 5 | 6 | import java.util.List; 7 | 8 | public interface ClientDistribution extends Client { 9 | 10 | List listDistribution(); 11 | 12 | Distribution addDistribution(AddDistributionRequest request); 13 | 14 | Distribution addDistributionStringsBased(AddDistributionStringsBasedRequest request); 15 | 16 | DistributionRelease release(String hash); 17 | 18 | DistributionStringsBasedRelease releaseStringsBased(String hash); 19 | 20 | DistributionRelease getDistributionRelease(String hash); 21 | 22 | DistributionStringsBasedRelease getDistributionStringsBasedRelease(String hash); 23 | 24 | Distribution editDistribution(String hash, List request); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/AppListSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | name = CommandNames.LIST 11 | ) 12 | class AppListSubcommand extends ActCommandProject { 13 | 14 | @Override 15 | protected NewAction getAction(Actions actions) { 16 | return actions.listApps(this.plainView); 17 | } 18 | 19 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 20 | protected boolean plainView; 21 | 22 | @Override 23 | protected final boolean isAnsi() { 24 | return super.isAnsi() && !plainView; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/BundleDeleteSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientBundle; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import org.apache.logging.log4j.util.Strings; 8 | import picocli.CommandLine; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | @CommandLine.Command( 14 | name = CommandNames.DELETE, 15 | sortOptions = false 16 | ) 17 | class BundleDeleteSubcommand extends ActCommandBundle { 18 | 19 | @CommandLine.Parameters(descriptionKey = "crowdin.bundle.delete.id") 20 | protected Long id; 21 | 22 | @Override 23 | protected NewAction getAction(Actions actions) { 24 | return actions.bundleDelete(id); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/BundleListSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientBundle; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | name = CommandNames.LIST 11 | ) 12 | class BundleListSubcommand extends ActCommandBundle { 13 | 14 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 15 | protected boolean plainView; 16 | 17 | @Override 18 | protected NewAction getAction(Actions actions) { 19 | return actions.bundleList(this.plainView, this.isVerbose); 20 | } 21 | 22 | @Override 23 | protected boolean isAnsi() { 24 | return super.isAnsi() && !plainView; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/PicocliOutputter.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.commands.Outputter; 4 | import picocli.CommandLine; 5 | 6 | import java.io.PrintStream; 7 | 8 | class PicocliOutputter implements Outputter { 9 | 10 | private PrintStream out; 11 | private CommandLine.Help.Ansi ansi; 12 | 13 | public PicocliOutputter(PrintStream out, boolean isOn) { 14 | this.out = out; 15 | this.ansi = (isOn) ? CommandLine.Help.Ansi.AUTO : CommandLine.Help.Ansi.OFF; 16 | } 17 | 18 | @Override 19 | public void println(String string) { 20 | this.out.println(format(string)); 21 | } 22 | 23 | @Override 24 | public void print(String string) { 25 | this.out.print(format(string)); 26 | } 27 | 28 | @Override 29 | public String format(String string) { 30 | return ansi.string(string); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/BranchListSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | name = CommandNames.LIST 11 | ) 12 | class BranchListSubcommand extends ActCommandProject { 13 | 14 | @Override 15 | protected NewAction getAction(Actions actions) { 16 | return actions.listBranches(this.noProgress, this.plainView); 17 | } 18 | 19 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 20 | protected boolean plainView; 21 | 22 | @Override 23 | protected final boolean isAnsi() { 24 | return super.isAnsi() && !plainView; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/GlossaryListSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientGlossary; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.BaseProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | name = CommandNames.LIST 11 | ) 12 | class GlossaryListSubcommand extends ActCommandGlossary { 13 | 14 | @Override 15 | protected NewAction getAction(Actions actions) { 16 | return actions.glossaryList(this.plainView, this.isVerbose); 17 | } 18 | 19 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 20 | protected boolean plainView; 21 | 22 | @Override 23 | protected final boolean isAnsi() { 24 | return super.isAnsi() && !plainView; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/actions/StringDeleteAction.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.actions; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.NewAction; 5 | import com.crowdin.cli.commands.Outputter; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | 8 | import static com.crowdin.cli.BaseCli.RESOURCE_BUNDLE; 9 | import static com.crowdin.cli.utils.console.ExecutionStatus.OK; 10 | 11 | class StringDeleteAction implements NewAction { 12 | 13 | private final Long id; 14 | 15 | public StringDeleteAction(Long id) { 16 | this.id = id; 17 | } 18 | 19 | @Override 20 | public void act(Outputter out, ProjectProperties pb, ProjectClient client) { 21 | client.deleteSourceString(id); 22 | out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.source_string_deleted"), this.id))); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/LabelAddSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientLabel; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | sortOptions = false, 11 | name = CommandNames.ADD 12 | ) 13 | public class LabelAddSubcommand extends ActCommandLabel { 14 | 15 | @CommandLine.Parameters(descriptionKey = "crowdin.label.title") 16 | protected String title; 17 | 18 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 19 | protected boolean plainView; 20 | 21 | @Override 22 | protected NewAction getAction(Actions actions) { 23 | return actions.labelAdd(title, plainView); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ActCommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.Client; 4 | import com.crowdin.cli.commands.Outputter; 5 | import com.crowdin.cli.properties.BaseParams; 6 | import com.crowdin.cli.properties.BaseProperties; 7 | import com.crowdin.cli.properties.PropertiesBuilders; 8 | import picocli.CommandLine; 9 | 10 | public abstract class ActCommand extends GenericActCommand { 11 | 12 | @CommandLine.Mixin 13 | private ConfigurationFilesProperties properties; 14 | 15 | @CommandLine.ArgGroup(exclusive = false, headingKey = "params.heading") 16 | private BaseParams params; 17 | 18 | @Override 19 | protected BaseProperties getProperties(PropertiesBuilders propertiesBuilders, Outputter out) { 20 | return propertiesBuilders.buildBaseProperties(out, properties.getConfigFile(), properties.getIdentityFile(), params); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/CommentAddSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | public class CommentAddSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testStringComment() { 13 | this.execute(CommandNames.COMMENT, CommandNames.ADD, "\"My Comment\"", "--string-id", "1", 14 | "--language", "en", "--type", "comment"); 15 | verify(actionsMock) 16 | .stringComment(anyBoolean(), any(), any(), any(), any(), any()); 17 | this.check(true); 18 | } 19 | 20 | @Test 21 | public void testStringCommentInvalidOptions() { 22 | this.executeInvalidParams(CommandNames.COMMENT, CommandNames.ADD, "\"My Comment\""); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/actions/AppUninstallAction.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.actions; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.NewAction; 5 | import com.crowdin.cli.commands.Outputter; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import com.crowdin.cli.utils.console.ExecutionStatus; 8 | import lombok.RequiredArgsConstructor; 9 | 10 | import static com.crowdin.cli.BaseCli.RESOURCE_BUNDLE; 11 | 12 | @RequiredArgsConstructor 13 | class AppUninstallAction implements NewAction { 14 | 15 | private final String id; 16 | private final boolean force; 17 | 18 | @Override 19 | public void act(Outputter out, ProjectProperties pb, ProjectClient client) { 20 | client.uninstallApplication(id, force); 21 | out.println(ExecutionStatus.OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.application.uninstall"), id))); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/AppUninstallSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | sortOptions = false, 11 | name = CommandNames.UNINSTALL 12 | ) 13 | class AppUninstallSubcommand extends ActCommandProject { 14 | 15 | @CommandLine.Parameters(descriptionKey = "crowdin.app.uninstall.identifier") 16 | protected String identifier; 17 | 18 | @CommandLine.Option(names = {"--force"}, descriptionKey = "crowdin.app.uninstall.force", order = -2) 19 | protected boolean force; 20 | 21 | @Override 22 | protected NewAction getAction(Actions actions) { 23 | return actions.uninstallApp(identifier, force); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/DistributionListSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientDistribution; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | sortOptions = false, 11 | name = CommandNames.LIST 12 | ) 13 | class DistributionListSubcommand extends ActCommandDistribution { 14 | 15 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 16 | protected boolean plainView; 17 | 18 | @Override 19 | protected NewAction getAction(Actions actions) { 20 | return actions.distributionList(this.plainView); 21 | } 22 | 23 | @Override 24 | protected boolean isAnsi() { 25 | return super.isAnsi() && !plainView; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/FileDeleteSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | import picocli.CommandLine.Command; 9 | import picocli.CommandLine.Parameters; 10 | 11 | @Command( 12 | name = CommandNames.DELETE, 13 | sortOptions = false 14 | ) 15 | class FileDeleteSubcommand extends ActCommandProject { 16 | 17 | @Parameters(descriptionKey = "crowdin.file.delete.file") 18 | protected String file; 19 | 20 | @CommandLine.Option(names = {"-b", "--branch"}, paramLabel = "...", order = -2) 21 | protected String branch; 22 | 23 | @Override 24 | protected NewAction getAction(Actions actions) { 25 | return actions.fileDelete(file, branch); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/UploadSourcesCommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | public class UploadSourcesCommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testUploadSources() { 13 | this.execute(CommandNames.UPLOAD); 14 | verify(actionsMock) 15 | .uploadSources(any(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean()); 16 | this.check(true); 17 | } 18 | 19 | @Test 20 | public void testUploadSourcesDryrun() { 21 | this.execute(CommandNames.UPLOAD, "--dryrun"); 22 | verify(actionsMock) 23 | .listSources(anyBoolean(), any(), anyBoolean(), anyBoolean(), anyBoolean()); 24 | this.check(true); 25 | } 26 | } -------------------------------------------------------------------------------- /website/mantemplates/crowdin-upload-translations.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-upload-translations 3 | 4 | == crowdin upload translations 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === Notes 19 | 20 | - `-l`, `--language=language_code` - defines the language translations that should be uploaded to Crowdin. By default, translations are uploaded to all project's target languages. link:https://developer.crowdin.com/language-codes/[Crowdin Language Codes]. 21 | -------------------------------------------------------------------------------- /src/main/resources/crowdin.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Basic Crowdin CLI configuration 3 | # See https://crowdin.github.io/crowdin-cli/configuration for more information 4 | # See https://support.crowdin.com/developer/configuration-file/ for all available options 5 | # 6 | 7 | # 8 | # Your Crowdin credentials 9 | # 10 | "project_id": "" 11 | "api_token": "" 12 | "base_path": "" 13 | "base_url": "" 14 | 15 | # 16 | # Defines whether to preserve the original directory structure in the Crowdin project 17 | # Recommended to set to true 18 | # 19 | "preserve_hierarchy": true 20 | 21 | # 22 | # Files configuration. 23 | # See https://support.crowdin.com/developer/configuration-file/ for all available options 24 | # 25 | files: [ 26 | { 27 | # 28 | # Source files filter 29 | # e.g. "/resources/en/*.json" 30 | # 31 | "source": "", 32 | 33 | # 34 | # Translation files filter 35 | # e.g. "/resources/%two_letters_code%/%original_file_name%" 36 | # 37 | "translation": "", 38 | } 39 | ] 40 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-pre-translate.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-pre-translate 3 | 4 | == crowdin pre-translate 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === Examples 19 | 20 | ---- 21 | crowdin pre-translate -l fr -l uk --method tm --file src/values/strings.xml 22 | crowdin pre-translate -l fr --method mt --engine-id 5 --file src/values/strings.xml 23 | crowdin pre-translate -l fr --method mt --engine-id 5 --branch main --file src/values/strings.xml 24 | ---- -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/DistributionReleaseSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientDistribution; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | name = CommandNames.DISTRIBUTION_RELEASE, 11 | sortOptions = false 12 | ) 13 | class DistributionReleaseSubcommand extends ActCommandDistribution { 14 | 15 | @CommandLine.Parameters(descriptionKey = "crowdin.distribution.release.hash") 16 | protected String hash; 17 | 18 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 19 | protected boolean plainView; 20 | 21 | @Override 22 | protected NewAction getAction(Actions actions) { 23 | return actions.distributionRelease(noProgress, plainView, hash); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/utils/OutputUtil.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.utils; 2 | 3 | import java.io.OutputStreamWriter; 4 | import java.io.PrintStream; 5 | import java.io.PrintWriter; 6 | import java.nio.charset.StandardCharsets; 7 | 8 | import static com.crowdin.cli.utils.console.ExecutionStatus.ERROR; 9 | 10 | public class OutputUtil { 11 | 12 | public static void fancyErr(Throwable e, PrintStream out, boolean debug) { 13 | fancyErr(e, new PrintWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8)), debug); 14 | } 15 | 16 | public static void fancyErr(Throwable e, PrintWriter out, boolean debug) { 17 | if (debug) { 18 | e.printStackTrace(); 19 | } else { 20 | out.println(ERROR.withIcon(e.getMessage())); 21 | Throwable cause = e; 22 | while ((cause = cause.getCause()) != null) { 23 | out.println(ERROR.withIcon(cause.getMessage())); 24 | } 25 | } 26 | out.flush(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ScreenshotListSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientScreenshot; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | sortOptions = false, 11 | name = CommandNames.LIST 12 | ) 13 | class ScreenshotListSubcommand extends ActCommandScreenshot { 14 | 15 | @CommandLine.Option(names = {"--string-id"}, paramLabel = "...", descriptionKey = "crowdin.screenshot.list.string-id", order = -2) 16 | private Long stringId; 17 | 18 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 19 | protected boolean plainView; 20 | 21 | @Override 22 | protected NewAction getAction(Actions actions) { 23 | return actions.screenshotList(this.stringId, this.plainView); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/StringListSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | public class StringListSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testStringList() { 13 | this.execute(CommandNames.STRING, CommandNames.LIST); 14 | verify(actionsMock) 15 | .stringList(anyBoolean(), anyBoolean(), any(), any(), any(), any(), any(), any(), any(), anyBoolean()); 16 | this.check(true); 17 | } 18 | 19 | @Test 20 | public void testStringList2() { 21 | this.execute(CommandNames.STRING, CommandNames.LIST, "--file", "some/path/to/file.txt"); 22 | verify(actionsMock) 23 | .stringList(anyBoolean(), anyBoolean(), any(), any(), any(), any(), any(), any(), any(), anyBoolean()); 24 | this.check(true); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/BranchEditSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.client.core.model.Priority; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import static org.mockito.Mockito.verify; 7 | 8 | public class BranchEditSubcommandTest extends PicocliTestUtils { 9 | 10 | @Test 11 | public void testBranchEdit() { 12 | String branchName = "main"; 13 | Priority priority = Priority.HIGH; 14 | this.execute(CommandNames.BRANCH, CommandNames.EDIT, branchName, "--priority", priority.name()); 15 | verify(actionsMock) 16 | .branchEdit(branchName, null, null, priority, false, false); 17 | this.check(true); 18 | } 19 | 20 | @Test 21 | public void testBranchEditInvalidOptions() { 22 | this.executeInvalidParams(CommandNames.BRANCH, CommandNames.EDIT); 23 | } 24 | 25 | @Test 26 | public void testBranchEditInvalidOptions2() { 27 | this.executeInvalidParams(CommandNames.BRANCH, CommandNames.EDIT, "--name", "test"); 28 | } 29 | } -------------------------------------------------------------------------------- /website/mantemplates/crowdin-bundle-clone.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-bundle-clone 3 | 4 | == crowdin bundle clone 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === Notes 19 | 20 | When cloning, the current bundle’s configuration is used as a base. Any parameters provided via the command line will 21 | override the corresponding values from the original configuration. 22 | 23 | === See also 24 | 25 | * link:https://support.crowdin.com/bundles/[Target File Bundles] 26 | * link:/crowdin-cli/commands/crowdin-bundle-download[`crowdin bundle download` command] 27 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/StringEditSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | public class StringEditSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testStringEdit() { 13 | this.execute(CommandNames.STRING, CommandNames.EDIT, "42", "--text", "NeW tExT"); 14 | verify(actionsMock) 15 | .stringEdit(anyBoolean(), anyBoolean(), any(), any(), any(), any(), any(), any(), any(), anyBoolean()); 16 | this.check(true); 17 | } 18 | 19 | @Test 20 | public void testStringEditInvalidOptions() { 21 | this.executeInvalidParams(CommandNames.STRING, CommandNames.EDIT); 22 | } 23 | 24 | @Test 25 | public void testStringEditInvalidOptions2() { 26 | this.executeInvalidParams(CommandNames.STRING, CommandNames.EDIT, "--id", "42", "--identifier", "4242"); 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/BranchCloneSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine.Option; 8 | import picocli.CommandLine.Command; 9 | import picocli.CommandLine.Parameters; 10 | 11 | @Command( 12 | sortOptions = false, 13 | name = CommandNames.CLONE 14 | ) 15 | class BranchCloneSubcommand extends ActCommandProject { 16 | 17 | @Parameters(descriptionKey = "crowdin.branch.clone.source") 18 | protected String source; 19 | 20 | @Parameters(descriptionKey = "crowdin.branch.clone.target") 21 | protected String target; 22 | 23 | @Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 24 | protected boolean plainView; 25 | 26 | @Override 27 | protected NewAction getAction(Actions actions) { 28 | return actions.branchClone(source, target, noProgress, plainView); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/FileDownloadSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.eq; 7 | import static org.mockito.Mockito.verify; 8 | 9 | class FileDownloadSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testFileDownload() { 13 | this.execute(CommandNames.FILE, CommandNames.FILE_DOWNLOAD, "file.txt"); 14 | verify(actionsMock).fileDownload(any(), any(), eq(false), any()); 15 | this.check(true); 16 | } 17 | 18 | @Test 19 | public void testFileDownloadTranslations() { 20 | this.execute(CommandNames.FILE, CommandNames.FILE_DOWNLOAD, "file.txt", "--language", "uk"); 21 | verify(actionsMock).fileDownloadTranslation(any(), any(), any(), eq(false), any()); 22 | this.check(true); 23 | } 24 | 25 | @Test 26 | public void testFileDownloadInvalidOptions() { 27 | this.executeInvalidParams(CommandNames.FILE, CommandNames.FILE_DOWNLOAD); 28 | } 29 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) crowdin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/UploadTranslationsSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.ArgumentMatchers.anyBoolean; 7 | import static org.mockito.Mockito.verify; 8 | 9 | public class UploadTranslationsSubcommandTest extends PicocliTestUtils { 10 | 11 | @Test 12 | public void testUploadTranslations() { 13 | this.execute(CommandNames.UPLOAD, CommandNames.UPLOAD_TRANSLATIONS); 14 | verify(actionsMock) 15 | .uploadTranslations(anyBoolean(), any(), any(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean()); 16 | this.check(true); 17 | } 18 | 19 | @Test 20 | public void testUploadTranslationsDryrun() { 21 | this.execute(CommandNames.UPLOAD, CommandNames.UPLOAD_TRANSLATIONS, "--dryrun"); 22 | verify(actionsMock) 23 | .listTranslations(anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean()); 24 | this.check(true); 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/CheckVersionSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.Clients; 4 | import com.crowdin.cli.client.NoClient; 5 | import com.crowdin.cli.commands.Actions; 6 | import com.crowdin.cli.commands.NewAction; 7 | import com.crowdin.cli.commands.Outputter; 8 | import com.crowdin.cli.properties.NoProperties; 9 | import com.crowdin.cli.properties.PropertiesBuilders; 10 | import picocli.CommandLine; 11 | 12 | @CommandLine.Command( 13 | name = CommandNames.CHECK_NEW_VERSION, 14 | hidden = true 15 | ) 16 | class CheckVersionSubcommand extends GenericActCommand { 17 | 18 | @Override 19 | protected NewAction getAction(Actions actions) { 20 | return actions.checkNewVersion(); 21 | } 22 | 23 | protected NoProperties getProperties(PropertiesBuilders propertiesBuilders, Outputter out) { 24 | return propertiesBuilders.buildNoProperties(); 25 | } 26 | 27 | protected NoClient getClient(NoProperties properties) { 28 | return Clients.noClient(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ConfigTranslationsSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.PropertiesWithFiles; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | name = CommandNames.TRANSLATIONS, 11 | sortOptions = false 12 | ) 13 | class ConfigTranslationsSubcommand extends ActCommandWithFiles { 14 | 15 | @CommandLine.Option(names = {"--tree"}, order = -2) 16 | protected boolean treeView; 17 | 18 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 19 | protected boolean plainView; 20 | 21 | @Override 22 | protected NewAction getAction(Actions actions) { 23 | return actions.listTranslations(this.noProgress, this.treeView, false, this.plainView, false, true, false); 24 | } 25 | 26 | @Override 27 | protected final boolean isAnsi() { 28 | return super.isAnsi() && !plainView; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/actions/AppListAction.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.actions; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.NewAction; 5 | import com.crowdin.cli.commands.Outputter; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | 8 | import static com.crowdin.cli.BaseCli.RESOURCE_BUNDLE; 9 | 10 | class AppListAction implements NewAction { 11 | private final boolean plainView; 12 | 13 | public AppListAction(boolean plainView) { 14 | this.plainView = plainView; 15 | } 16 | 17 | @Override 18 | public void act(Outputter out, ProjectProperties pb, ProjectClient client) { 19 | client 20 | .listApplications() 21 | .forEach(app -> { 22 | if (!plainView) { 23 | out.println(String.format(RESOURCE_BUNDLE.getString("message.application.list"), app.getIdentifier(), app.getName())); 24 | } else { 25 | out.println(app.getIdentifier()); 26 | } 27 | }); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/CrowdinClientTask.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | import com.crowdin.client.tasks.model.AddTaskRequest; 4 | import com.crowdin.client.tasks.model.Status; 5 | import com.crowdin.client.tasks.model.Task; 6 | 7 | import java.util.List; 8 | 9 | public class CrowdinClientTask extends CrowdinClientCore implements ClientTask { 10 | 11 | private final com.crowdin.client.Client client; 12 | private final String projectId; 13 | 14 | public CrowdinClientTask(com.crowdin.client.Client client, String projectId) { 15 | this.client = client; 16 | this.projectId = projectId; 17 | } 18 | 19 | @Override 20 | public List listTask(Status status) { 21 | return executeRequestFullList((limit, offset) -> this.client.getTasksApi() 22 | .listTasks(Long.valueOf(projectId), limit, offset, status, null)); 23 | } 24 | 25 | @Override 26 | public Task addTask(AddTaskRequest taskRequest) { 27 | return executeRequest(() -> this.client.getTasksApi() 28 | .addTask(Long.valueOf(projectId), taskRequest) 29 | .getData()); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-download-sources.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-download-sources 3 | 4 | == crowdin download sources 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === Notes 19 | 20 | - This command relies on the source files and folder structure in Crowdin and will download them to the same structure locally. If you're using the `preserve_hierarchy` option as `false`, it may skip directories when uploading sources to Crowdin and as a result the downloaded sources may be placed in a different location than the original ones. It's highly recommended to use `"preserve_hierarchy": true` if you want to use this command. 21 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/actions/ScreenshotDeleteAction.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.actions; 2 | 3 | import com.crowdin.cli.client.ClientScreenshot; 4 | import com.crowdin.cli.commands.NewAction; 5 | import com.crowdin.cli.commands.Outputter; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import com.crowdin.cli.utils.console.ExecutionStatus; 8 | import com.crowdin.client.screenshots.model.Screenshot; 9 | 10 | import static com.crowdin.cli.BaseCli.RESOURCE_BUNDLE; 11 | 12 | class ScreenshotDeleteAction implements NewAction { 13 | 14 | private final Long id; 15 | 16 | public ScreenshotDeleteAction(Long id) { 17 | this.id = id; 18 | } 19 | 20 | @Override 21 | public void act(Outputter out, ProjectProperties properties, ClientScreenshot client) { 22 | Screenshot screenshot = client.getScreenshot(id); 23 | if (screenshot != null) { 24 | client.deleteScreenshot(id); 25 | out.println(ExecutionStatus.OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.screenshot.deleted"), id, screenshot.getName()))); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ActCommandBundle.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientBundle; 4 | import com.crowdin.cli.commands.Outputter; 5 | import com.crowdin.cli.properties.ProjectParams; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import com.crowdin.cli.properties.PropertiesBuilders; 8 | import picocli.CommandLine; 9 | 10 | public abstract class ActCommandBundle extends GenericActCommand { 11 | 12 | @CommandLine.Mixin 13 | private ConfigurationFilesProperties properties; 14 | 15 | @CommandLine.ArgGroup(exclusive = false, headingKey = "params.heading") 16 | private ProjectParams params; 17 | 18 | @Override 19 | protected ProjectProperties getProperties(PropertiesBuilders propertiesBuilders, Outputter out) { 20 | return propertiesBuilders.buildProjectProperties(out, properties.getConfigFile(), properties.getIdentityFile(), params); 21 | } 22 | 23 | @Override 24 | protected ClientBundle getClient(ProjectProperties properties) { 25 | return GenericActCommand.getBundleClient(properties); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ActCommandComment.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientComment; 4 | import com.crowdin.cli.commands.Outputter; 5 | import com.crowdin.cli.properties.ProjectParams; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import com.crowdin.cli.properties.PropertiesBuilders; 8 | import picocli.CommandLine; 9 | 10 | public abstract class ActCommandComment extends GenericActCommand { 11 | 12 | @CommandLine.Mixin 13 | private ConfigurationFilesProperties properties; 14 | 15 | @CommandLine.ArgGroup(exclusive = false, headingKey = "params.heading") 16 | private ProjectParams params; 17 | 18 | @Override 19 | protected ProjectProperties getProperties(PropertiesBuilders propertiesBuilders, Outputter out) { 20 | return propertiesBuilders.buildProjectProperties(out, properties.getConfigFile(), properties.getIdentityFile(), params); 21 | } 22 | 23 | @Override 24 | protected ClientComment getClient(ProjectProperties properties) { 25 | return GenericActCommand.getCommentClient(properties); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ActCommandProject.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Outputter; 5 | import com.crowdin.cli.properties.ProjectProperties; 6 | import com.crowdin.cli.properties.ProjectParams; 7 | import com.crowdin.cli.properties.PropertiesBuilders; 8 | import picocli.CommandLine; 9 | 10 | public abstract class ActCommandProject extends GenericActCommand { 11 | 12 | @CommandLine.Mixin 13 | private ConfigurationFilesProperties properties; 14 | 15 | @CommandLine.ArgGroup(exclusive = false, headingKey = "params.heading") 16 | private ProjectParams params; 17 | 18 | @Override 19 | protected ProjectProperties getProperties(PropertiesBuilders propertiesBuilders, Outputter out) { 20 | return propertiesBuilders.buildProjectProperties(out, properties.getConfigFile(), properties.getIdentityFile(), params); 21 | } 22 | 23 | @Override 24 | protected ProjectClient getClient(ProjectProperties properties) { 25 | return GenericActCommand.getProjectClient(properties); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ActCommandLabel.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientLabel; 4 | import com.crowdin.cli.commands.Outputter; 5 | import com.crowdin.cli.properties.ProjectParams; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import com.crowdin.cli.properties.PropertiesBuilders; 8 | import picocli.CommandLine; 9 | 10 | public abstract class ActCommandLabel extends GenericActCommand { 11 | 12 | @CommandLine.Mixin 13 | private ConfigurationFilesProperties properties; 14 | 15 | @CommandLine.ArgGroup(exclusive = false, headingKey = "params.heading") 16 | private ProjectParams params; 17 | 18 | @Override 19 | protected ProjectProperties getProperties(PropertiesBuilders propertiesBuilders, Outputter out) { 20 | return propertiesBuilders.buildProjectProperties(out, properties.getConfigFile(), properties.getIdentityFile(), params); 21 | } 22 | 23 | @Override 24 | protected ClientLabel getClient(ProjectProperties properties) { 25 | return GenericActCommand.getLabelClient(properties); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ConfigSourcesSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.PropertiesWithFiles; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | name = CommandNames.SOURCES, 11 | sortOptions = false 12 | ) 13 | class ConfigSourcesSubcommand extends ActCommandWithFiles { 14 | 15 | @CommandLine.Option(names = {"-b", "--branch"}, order = -2) 16 | protected String branch; 17 | 18 | @CommandLine.Option(names = {"--tree"}, order = -2) 19 | protected boolean treeView; 20 | 21 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 22 | protected boolean plainView; 23 | 24 | @Override 25 | protected NewAction getAction(Actions actions) { 26 | return actions.listSources(false, null, this.noProgress, this.treeView, this.plainView); 27 | } 28 | 29 | @Override 30 | protected final boolean isAnsi() { 31 | return super.isAnsi() && !plainView; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/CommentResolveSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | 6 | import java.util.List; 7 | 8 | import static org.junit.jupiter.api.Assertions.assertTrue; 9 | import static org.mockito.ArgumentMatchers.any; 10 | import static org.mockito.Mockito.verify; 11 | 12 | public class CommentResolveSubcommandTest extends PicocliTestUtils { 13 | 14 | @Test 15 | public void testCommentResolve() { 16 | this.execute(CommandNames.COMMENT, CommandNames.COMMENT_RESOLVE, "1"); 17 | verify(actionsMock).resolve(any()); 18 | this.check(true); 19 | } 20 | 21 | @Test 22 | public void testCommentResolveInvalidOptions() { 23 | this.executeInvalidParams(CommandNames.COMMENT, CommandNames.COMMENT_RESOLVE, "incorrectId"); 24 | } 25 | 26 | @Test 27 | public void testSubCommandCheckValidOptions() { 28 | CommentResolveSubcommand commentResolveSubcommand = new CommentResolveSubcommand(); 29 | commentResolveSubcommand.id = 1l; 30 | List errors = commentResolveSubcommand.checkOptions(); 31 | assertTrue(errors.isEmpty()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /website/mantemplates/crowdin-tm-upload.adoc: -------------------------------------------------------------------------------- 1 | :includedir: ../generated-picocli-docs 2 | :command: crowdin-tm-upload 3 | 4 | == crowdin tm upload 5 | 6 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] 7 | 8 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] 9 | 10 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] 11 | 12 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] 13 | 14 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] 15 | 16 | include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] 17 | 18 | === Notes 19 | 20 | To form the scheme for your CSV or XLS/XLSX glossary file, use the following constants: 21 | 22 | - `+{language_code}+` – Column contains translation memory elements for the specified language. 23 | - `+{column_number}+` – Column number.Numbering starts from 0. 24 | 25 | Where `+{language_code}+` – Language code for the specified language.See the full list of https://developer.crowdin.com/language-codes[Supported Languages]. 26 | 27 | `--first-line-contains-header` – used to skip the import of the first row (header). 28 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/RootCommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import picocli.CommandLine; 4 | 5 | @CommandLine.Command( 6 | name = "crowdin", 7 | subcommands = { 8 | UploadSubcommand.class, 9 | DownloadSubcommand.class, 10 | InitSubcommand.class, 11 | StatusSubcommand.class, 12 | StringSubcommand.class, 13 | GlossarySubcommand.class, 14 | TmSubcommand.class, 15 | TaskSubcommand.class, 16 | BundleSubcommand.class, 17 | CheckVersionSubcommand.class, 18 | PreTranslateSubcommand.class, 19 | BranchSubcommand.class, 20 | CommentSubcommand.class, 21 | DistributionSubcommand.class, 22 | ScreenshotSubcommand.class, 23 | LabelSubcommand.class, 24 | FileSubcommand.class, 25 | LanguageSubcommand.class, 26 | ConfigSubcommand.class, 27 | ProjectSubcommand.class, 28 | CompletionSubCommand.class, 29 | ApplicationSubcommand.class 30 | }) 31 | class RootCommand extends HelpCommand { 32 | @Override 33 | protected CommandLine getCommand(CommandLine rootCommand) { 34 | return rootCommand; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/FileListSubcommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.Actions; 5 | import com.crowdin.cli.commands.NewAction; 6 | import com.crowdin.cli.properties.ProjectProperties; 7 | import picocli.CommandLine; 8 | 9 | @CommandLine.Command( 10 | name = CommandNames.LIST, 11 | sortOptions = false 12 | ) 13 | class FileListSubcommand extends ActCommandProject { 14 | 15 | @CommandLine.Option(names = {"-b", "--branch"}, paramLabel = "...", order = -2) 16 | protected String branch; 17 | 18 | @CommandLine.Option(names = {"--tree"}, order = -2) 19 | protected boolean treeView; 20 | 21 | @CommandLine.Option(names = {"--plain"}, descriptionKey = "crowdin.list.usage.plain") 22 | protected boolean plainView; 23 | 24 | @Override 25 | protected NewAction getAction(Actions actions) { 26 | return actions.listFiles(this.noProgress, this.branch, this.treeView, this.plainView, this.isVerbose); 27 | } 28 | 29 | @Override 30 | protected final boolean isAnsi() { 31 | return super.isAnsi() && !plainView; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/utils/PlaceholderUtilBuilder.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.utils; 2 | 3 | import com.crowdin.client.languages.model.Language; 4 | 5 | import java.util.ArrayList; 6 | import java.util.Arrays; 7 | import java.util.List; 8 | 9 | public enum PlaceholderUtilBuilder { 10 | STANDART( 11 | new LanguageBuilder[] { LanguageBuilder.DEU, LanguageBuilder.ENG, LanguageBuilder.RUS, LanguageBuilder.UKR }, 12 | new LanguageBuilder[] { LanguageBuilder.UKR, LanguageBuilder.ENG }); 13 | 14 | private List supportedLanguages = new ArrayList<>(); 15 | private List projectLanguages = new ArrayList<>(); 16 | 17 | PlaceholderUtilBuilder(LanguageBuilder[] supportedLanguagesArray, LanguageBuilder[] projectLanguagesArray) { 18 | Arrays.stream(supportedLanguagesArray) 19 | .map(LanguageBuilder::build) 20 | .forEach(supportedLanguages::add); 21 | Arrays.stream(projectLanguagesArray) 22 | .map(LanguageBuilder::build) 23 | .forEach(projectLanguages::add); 24 | } 25 | 26 | public PlaceholderUtil build(String basePath) { 27 | return new PlaceholderUtil(projectLanguages, basePath); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/properties/NewBasePropertiesUtilBuilder.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.properties; 2 | 3 | public class NewBasePropertiesUtilBuilder { 4 | 5 | public static final String TEST_API_TOKEN = "123abc456"; 6 | public static final String TEST_BASE_URL = "https://crowdin.com"; 7 | public static final String TEST_BASE_PATH = "."; 8 | 9 | private BaseProperties pb; 10 | 11 | public static NewBasePropertiesUtilBuilder minimalBuilt() { 12 | return minimalBuilt(TEST_API_TOKEN, TEST_BASE_URL, TEST_BASE_PATH); 13 | } 14 | 15 | public static NewBasePropertiesUtilBuilder minimalBuilt(String apiToken, String baseUrl, String basePath) { 16 | BaseProperties pb = new BaseProperties(); 17 | pb.setApiToken(apiToken); 18 | pb.setBaseUrl(baseUrl); 19 | pb.setBasePath(basePath); 20 | NewBasePropertiesUtilBuilder builder = new NewBasePropertiesUtilBuilder(); 21 | builder.pb = pb; 22 | return builder; 23 | } 24 | 25 | public NewBasePropertiesUtilBuilder setApiToken(String apiToken) { 26 | pb.setApiToken(apiToken); 27 | return this; 28 | } 29 | 30 | public BaseProperties build() { 31 | return pb; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/properties/NewProjectPropertiesUtilBuilder.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.properties; 2 | 3 | import static com.crowdin.cli.properties.NewBasePropertiesUtilBuilder.TEST_API_TOKEN; 4 | import static com.crowdin.cli.properties.NewBasePropertiesUtilBuilder.TEST_BASE_PATH; 5 | import static com.crowdin.cli.properties.NewBasePropertiesUtilBuilder.TEST_BASE_URL; 6 | 7 | public class NewProjectPropertiesUtilBuilder { 8 | 9 | public static final String TEST_PROJECT_ID = "666"; 10 | 11 | private ProjectProperties pb; 12 | 13 | public static NewProjectPropertiesUtilBuilder minimalBuilt() { 14 | return minimalBuilt(TEST_PROJECT_ID); 15 | } 16 | 17 | public static NewProjectPropertiesUtilBuilder minimalBuilt(String projectId) { 18 | ProjectProperties pb = new ProjectProperties(); 19 | pb.setApiToken(TEST_API_TOKEN); 20 | pb.setBaseUrl(TEST_BASE_URL); 21 | pb.setBasePath(TEST_BASE_PATH); 22 | pb.setProjectId(projectId); 23 | NewProjectPropertiesUtilBuilder builder = new NewProjectPropertiesUtilBuilder(); 24 | builder.pb = pb; 25 | return builder; 26 | } 27 | 28 | public ProjectProperties build() { 29 | return pb; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/ActCommandTask.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.client.ClientTask; 4 | import com.crowdin.cli.client.Clients; 5 | import com.crowdin.cli.commands.Outputter; 6 | import com.crowdin.cli.properties.ProjectParams; 7 | import com.crowdin.cli.properties.ProjectProperties; 8 | import com.crowdin.cli.properties.PropertiesBuilders; 9 | import picocli.CommandLine; 10 | 11 | public abstract class ActCommandTask extends GenericActCommand { 12 | 13 | @CommandLine.Mixin 14 | private ConfigurationFilesProperties properties; 15 | 16 | @CommandLine.ArgGroup(exclusive = false, headingKey = "params.heading") 17 | private ProjectParams params; 18 | 19 | @Override 20 | protected ProjectProperties getProperties(PropertiesBuilders propertiesBuilders, Outputter out) { 21 | return propertiesBuilders.buildProjectProperties(out, properties.getConfigFile(), properties.getIdentityFile(), params); 22 | } 23 | 24 | @Override 25 | protected ClientTask getClient(ProjectProperties properties) { 26 | return Clients.getClientTask(properties.getApiToken(), properties.getBaseUrl(), properties.getProjectId()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /website/src/css/custom.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Any CSS included here will be global. The classic template 3 | * bundles Infima by default. Infima is a CSS framework designed to 4 | * work well for content-centric websites. 5 | */ 6 | 7 | /* You can override the default Infima variables here. */ 8 | :root { 9 | --ifm-color-primary: #2e8555; 10 | --ifm-color-primary-dark: #29784c; 11 | --ifm-color-primary-darker: #277148; 12 | --ifm-color-primary-darkest: #205d3b; 13 | --ifm-color-primary-light: #33925d; 14 | --ifm-color-primary-lighter: #359962; 15 | --ifm-color-primary-lightest: #3cad6e; 16 | --ifm-code-font-size: 95%; 17 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); 18 | } 19 | 20 | /* For readability concerns, you should choose a lighter palette in dark mode. */ 21 | [data-theme='dark'] { 22 | --ifm-color-primary: #25c2a0; 23 | --ifm-color-primary-dark: #21af90; 24 | --ifm-color-primary-darker: #1fa588; 25 | --ifm-color-primary-darkest: #1a8870; 26 | --ifm-color-primary-light: #29d5b0; 27 | --ifm-color-primary-lighter: #32d8b4; 28 | --ifm-color-primary-lightest: #4fddbf; 29 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); 30 | } 31 | 32 | .pagination-nav, 33 | .pagination-nav__sublabel { 34 | display: none; 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/actions/AppInstallAction.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.actions; 2 | 3 | import com.crowdin.cli.client.ProjectClient; 4 | import com.crowdin.cli.commands.NewAction; 5 | import com.crowdin.cli.commands.Outputter; 6 | import com.crowdin.cli.commands.picocli.ExitCodeExceptionMapper; 7 | import com.crowdin.cli.properties.ProjectProperties; 8 | import com.crowdin.cli.utils.console.ExecutionStatus; 9 | import lombok.RequiredArgsConstructor; 10 | 11 | import static com.crowdin.cli.BaseCli.RESOURCE_BUNDLE; 12 | 13 | @RequiredArgsConstructor 14 | class AppInstallAction implements NewAction { 15 | 16 | private final String id; 17 | 18 | @Override 19 | public void act(Outputter out, ProjectProperties pb, ProjectClient client) { 20 | var manifestUrl = client.findManifestUrl(id); 21 | if (manifestUrl.isEmpty()) { 22 | throw new ExitCodeExceptionMapper.NotFoundException(String.format(RESOURCE_BUNDLE.getString("error.application_not_found"), this.id)); 23 | } 24 | client.installApplication(manifestUrl.get()); 25 | out.println(ExecutionStatus.OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.application.install"), id))); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/com/crowdin/cli/commands/picocli/TmUploadSubcommandTest.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import lombok.SneakyThrows; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import java.nio.file.Path; 7 | 8 | import static org.mockito.ArgumentMatchers.*; 9 | import static org.mockito.Mockito.verify; 10 | 11 | public class TmUploadSubcommandTest extends PicocliTestUtils { 12 | 13 | @SneakyThrows 14 | @Test 15 | public void testTmUpload() { 16 | var file = Path.of(this.getClass().getClassLoader().getResource("file.tmx").toURI()).toFile(); 17 | this.execute(CommandNames.TM, CommandNames.TM_UPLOAD, file.getAbsolutePath(), "--id", "42", "--debug"); 18 | verify(actionsMock) 19 | .tmUpload(any(), eq(42L), isNull(), isNull(), isNull(), anyBoolean()); 20 | this.check(true); 21 | } 22 | 23 | @Test 24 | public void testTmUpload_throwsNoSchemeForCsv() { 25 | this.executeInvalidParams(CommandNames.TM, CommandNames.TM_UPLOAD, "file.csv", "--id", "42", "--debug"); 26 | } 27 | 28 | @Test 29 | public void testTmUpload_throwsFileHasWrongFormat() { 30 | this.executeInvalidParams(CommandNames.TM, CommandNames.TM_UPLOAD, "file.tbx", "--id", "42", "--debug"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/commands/picocli/GenericCommand.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.commands.picocli; 2 | 3 | import com.crowdin.cli.BaseCli; 4 | import picocli.CommandLine; 5 | 6 | import java.util.ResourceBundle; 7 | 8 | @CommandLine.Command( 9 | name = "command", 10 | versionProvider = PicocliRunner.VersionProvider.class, 11 | usageHelpAutoWidth = true, 12 | resourceBundle = "messages.messages" 13 | ) 14 | public abstract class GenericCommand implements Runnable { 15 | 16 | @CommandLine.Option(names = {"-V", "--version"}, versionHelp = true) 17 | boolean versionInfoRequested; 18 | 19 | @CommandLine.Option(names = {"-h", "--help"}, usageHelp = true) 20 | boolean usageHelpRequested; 21 | 22 | @CommandLine.Option(names = {"--no-progress"}) 23 | protected boolean noProgress; 24 | 25 | @CommandLine.Option(names = {"-v", "--verbose"}) 26 | protected boolean isVerbose; 27 | 28 | @CommandLine.Option(names = {"--debug"}, hidden = true) 29 | protected boolean debug; 30 | 31 | @CommandLine.Option(names = {"--no-colors"}) 32 | protected boolean noColors; 33 | 34 | protected static final ResourceBundle RESOURCE_BUNDLE = BaseCli.RESOURCE_BUNDLE; 35 | 36 | @Override 37 | public abstract void run(); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/properties/SettingsBean.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.properties; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Map; 6 | 7 | import static com.crowdin.cli.properties.PropertiesBuilder.IGNORE_HIDDEN_FILES; 8 | 9 | @Data 10 | public class SettingsBean { 11 | 12 | static SettingsBeanConfigurator CONFIGURATOR = new SettingsBeanConfigurator(); 13 | 14 | private Boolean ignoreHiddenFiles; 15 | 16 | static class SettingsBeanConfigurator implements BeanConfigurator { 17 | 18 | private SettingsBeanConfigurator() { 19 | 20 | } 21 | 22 | @Override 23 | public SettingsBean buildFromMap(Map map) { 24 | SettingsBean settingsBean = new SettingsBean(); 25 | if (map == null) { 26 | return settingsBean; 27 | } 28 | PropertiesBuilder.setBooleanPropertyIfExists(settingsBean::setIgnoreHiddenFiles, map, IGNORE_HIDDEN_FILES); 29 | return settingsBean; 30 | } 31 | 32 | @Override 33 | public void populateWithDefaultValues(SettingsBean bean) { 34 | if (bean.getIgnoreHiddenFiles() == null) { 35 | bean.setIgnoreHiddenFiles(true); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/crowdin/cli/client/CrowdinClientLabel.java: -------------------------------------------------------------------------------- 1 | package com.crowdin.cli.client; 2 | 3 | import com.crowdin.client.Client; 4 | import com.crowdin.client.labels.model.AddLabelRequest; 5 | import com.crowdin.client.labels.model.Label; 6 | import lombok.AllArgsConstructor; 7 | 8 | import java.util.List; 9 | 10 | import static java.lang.Long.parseLong; 11 | 12 | @AllArgsConstructor 13 | public class CrowdinClientLabel extends CrowdinClientCore implements ClientLabel { 14 | 15 | private final Client client; 16 | private final String projectId; 17 | 18 | @Override 19 | public List