-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/com/crowdin/cli/commands/actions/AppUninstallAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.crowdin.cli.commands.actions; | ||
|
||
import com.crowdin.cli.client.ProjectClient; | ||
import com.crowdin.cli.commands.NewAction; | ||
import com.crowdin.cli.commands.Outputter; | ||
import com.crowdin.cli.properties.ProjectProperties; | ||
import com.crowdin.cli.utils.console.ExecutionStatus; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import static com.crowdin.cli.BaseCli.RESOURCE_BUNDLE; | ||
|
||
@RequiredArgsConstructor | ||
class AppUninstallAction implements NewAction<ProjectProperties, ProjectClient> { | ||
|
||
private final String id; | ||
private final boolean force; | ||
|
||
@Override | ||
public void act(Outputter out, ProjectProperties pb, ProjectClient client) { | ||
client.uninstallApplication(id, force); | ||
out.println(ExecutionStatus.OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.application.uninstall"), id))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/com/crowdin/cli/commands/picocli/AppUninstallSubcommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.crowdin.cli.commands.picocli; | ||
|
||
import com.crowdin.cli.client.ProjectClient; | ||
import com.crowdin.cli.commands.Actions; | ||
import com.crowdin.cli.commands.NewAction; | ||
import com.crowdin.cli.properties.ProjectProperties; | ||
import picocli.CommandLine; | ||
|
||
@CommandLine.Command( | ||
sortOptions = false, | ||
name = CommandNames.UNINSTALL | ||
) | ||
class AppUninstallSubcommand extends ActCommandProject { | ||
|
||
@CommandLine.Parameters(descriptionKey = "crowdin.app.uninstall.identifier") | ||
protected String identifier; | ||
|
||
@CommandLine.Option(names = {"--force"}, descriptionKey = "crowdin.app.uninstall.force", order = -2) | ||
protected boolean force; | ||
|
||
@Override | ||
protected NewAction<ProjectProperties, ProjectClient> getAction(Actions actions) { | ||
return actions.uninstallApp(identifier, force); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/test/java/com/crowdin/cli/commands/picocli/AppUninstallSubcommandTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.crowdin.cli.commands.picocli; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.mockito.ArgumentMatchers.anyBoolean; | ||
import static org.mockito.Mockito.verify; | ||
|
||
public class AppUninstallSubcommandTest extends PicocliTestUtils { | ||
|
||
@Test | ||
public void testAppUninstall() { | ||
var appId = "test-app"; | ||
this.execute(CommandNames.APP, CommandNames.UNINSTALL, appId); | ||
verify(actionsMock).uninstallApp(appId, false); | ||
this.check(true); | ||
} | ||
|
||
@Test | ||
public void testAppUninstallForce() { | ||
var appId = "test-app"; | ||
this.execute(CommandNames.APP, CommandNames.UNINSTALL, appId, "--force"); | ||
verify(actionsMock).uninstallApp(appId, true); | ||
this.check(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
:includedir: ../generated-picocli-docs | ||
:command: crowdin-app-uninstall | ||
|
||
== crowdin app uninstall | ||
|
||
include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-description] | ||
|
||
include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-synopsis] | ||
|
||
include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-arguments] | ||
|
||
include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-commands] | ||
|
||
include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-options] | ||
|
||
include::{includedir}/{command}.adoc[tag=picocli-generated-man-section-footer] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters