-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): enhance plugin management
Changes: * add new interface PluginManager * add new CLI for un-installing plugins * refactor service for downloading plugins
- Loading branch information
1 parent
7696bae
commit eb9de27
Showing
18 changed files
with
984 additions
and
297 deletions.
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
59 changes: 59 additions & 0 deletions
59
cli/src/main/java/io/kestra/cli/commands/plugins/PluginUninstallCommand.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,59 @@ | ||
package io.kestra.cli.commands.plugins; | ||
|
||
import io.kestra.cli.AbstractCommand; | ||
import io.kestra.core.plugins.PluginArtifact; | ||
import io.kestra.core.plugins.PluginManager; | ||
import jakarta.inject.Inject; | ||
import jakarta.inject.Provider; | ||
import picocli.CommandLine; | ||
import picocli.CommandLine.Parameters; | ||
import picocli.CommandLine.Spec; | ||
|
||
import java.net.URI; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@CommandLine.Command( | ||
name = "uninstall", | ||
description = "uninstall a plugin" | ||
) | ||
public class PluginUninstallCommand extends AbstractCommand { | ||
@Parameters(index = "0..*", description = "the plugins to uninstall") | ||
List<String> dependencies = new ArrayList<>(); | ||
|
||
@Spec | ||
CommandLine.Model.CommandSpec spec; | ||
|
||
@Inject | ||
private Provider<PluginManager> pluginManager; | ||
|
||
@Override | ||
public Integer call() throws Exception { | ||
super.call(); | ||
|
||
List<PluginArtifact> pluginArtifacts; | ||
try { | ||
pluginArtifacts = dependencies.stream().map(PluginArtifact::fromCoordinates).toList(); | ||
} catch (IllegalArgumentException e) { | ||
stdErr(e.getMessage()); | ||
return CommandLine.ExitCode.USAGE; | ||
} | ||
|
||
PluginManager pluginManager = this.pluginManager.get(); | ||
|
||
List<PluginArtifact> uninstalled = pluginManager.uninstall( | ||
pluginArtifacts, | ||
false, | ||
pluginsPath | ||
); | ||
|
||
List<URI> uris = uninstalled.stream().map(PluginArtifact::uri).toList(); | ||
stdOut("Successfully uninstalled plugins {0} from {1}", dependencies, uris); | ||
return CommandLine.ExitCode.OK; | ||
} | ||
|
||
@Override | ||
protected boolean loadExternalPlugins() { | ||
return false; | ||
} | ||
} |
Oops, something went wrong.