-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfe612f
commit 6545ecc
Showing
6 changed files
with
53 additions
and
28 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
29 changes: 29 additions & 0 deletions
29
...cli/src/main/java/matcher/cli/provider/builtin/AdditionalPluginsCliParameterProvider.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,29 @@ | ||
package matcher.cli.provider.builtin; | ||
|
||
import java.nio.file.Path; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import com.beust.jcommander.Parameter; | ||
|
||
import matcher.PluginLoader; | ||
import matcher.cli.provider.CliParameterProvider; | ||
|
||
/** | ||
* Provides the default {@code --additional-plugins} parameter. | ||
* If the parameter is present, the passed plugins are automatically loaded. | ||
*/ | ||
public class AdditionalPluginsCliParameterProvider implements CliParameterProvider { | ||
@Parameter(names = {BuiltinCliParameters.ADDITIONAL_PLUGINS}) | ||
List<Path> additionalPlugins = Collections.emptyList(); | ||
|
||
@Override | ||
public Object getDataHolder() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public void processArgs() { | ||
PluginLoader.run(additionalPlugins); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,14 +1,30 @@ | ||
package matcher.gui; | ||
|
||
import java.util.Collections; | ||
import java.nio.file.Paths; | ||
|
||
import javafx.application.Application; | ||
|
||
import matcher.PluginLoader; | ||
import matcher.cli.MatcherCli; | ||
import matcher.cli.provider.builtin.AdditionalPluginsCliParameterProvider; | ||
import matcher.config.Config; | ||
import matcher.gui.cli.PreLaunchGuiCliParameterProvider; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
Config.init(); | ||
PluginLoader.run(args); | ||
PluginLoader.run(Collections.singletonList(Paths.get("plugins"))); | ||
|
||
handlePreLaunchStartupArgs(args); | ||
Application.launch(MatcherGui.class, args); | ||
} | ||
|
||
private static void handlePreLaunchStartupArgs(String[] args) { | ||
MatcherCli cli = new MatcherCli(true); | ||
|
||
cli.registerParameterProvider(new AdditionalPluginsCliParameterProvider()); | ||
cli.registerParameterProvider(new PreLaunchGuiCliParameterProvider()); | ||
cli.processArgs(args); | ||
} | ||
} |
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