File tree Expand file tree Collapse file tree 3 files changed +13
-11
lines changed
src/main/java/org/hydev/mcpm/client/arguments Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 5
5
import org .hydev .mcpm .client .arguments .parsers .*;
6
6
import org .hydev .mcpm .client .commands .controllers .*;
7
7
import org .hydev .mcpm .client .display .presenters .LogExportPresenter ;
8
+ import org .hydev .mcpm .client .display .presenters .LogImportPresenter ;
8
9
import org .hydev .mcpm .client .display .progress .ProgressBarFetcherListener ;
9
10
import org .hydev .mcpm .client .export .ExportInteractor ;
11
+ import org .hydev .mcpm .client .export .ImportInteractor ;
10
12
import org .hydev .mcpm .client .injector .LocalJarFinder ;
11
13
import org .hydev .mcpm .client .injector .PluginLoader ;
12
14
import org .hydev .mcpm .client .installer .InstallInteractor ;
@@ -61,6 +63,7 @@ public static List<CommandParser> baseParsers(boolean isMinecraft) {
61
63
// Controllers
62
64
var exportPluginsController = new ExportController (
63
65
new ExportInteractor (tracker ), new LogExportPresenter ());
66
+ var importController = new ImportController (new ImportInteractor (installer ), new LogImportPresenter ());
64
67
var listController = new ListController (new ListAllInteractor (tracker ));
65
68
var searchController = new SearchPackagesController (searcher , pager );
66
69
var mirrorController = new MirrorController (mirror );
Original file line number Diff line number Diff line change 10
10
/**
11
11
* Parser for the ExportPluginsBoundary interface.
12
12
*/
13
- public class ExportPluginsParser implements CommandParser
13
+ public record ExportPluginsParser ( ExportController controller ) implements CommandParser
14
14
{
15
- private final ExportController controller ;
16
-
17
- public ExportPluginsParser (ExportController controller )
18
- {
19
- this .controller = controller ;
20
- }
21
-
22
15
@ Override
23
16
public String name ()
24
17
{
Original file line number Diff line number Diff line change 2
2
3
3
import net .sourceforge .argparse4j .inf .Namespace ;
4
4
import net .sourceforge .argparse4j .inf .Subparser ;
5
+ import org .hydev .mcpm .client .commands .controllers .ImportController ;
6
+ import org .hydev .mcpm .client .export .ImportInput ;
5
7
6
8
import java .util .function .Consumer ;
7
9
8
10
/**
9
11
* Parser for the import use case
10
12
*/
11
- public class ImportParser implements CommandParser {
13
+ public record ImportParser ( ImportController controller ) implements CommandParser {
12
14
@ Override
13
15
public String name () {
14
16
return "import" ;
@@ -21,11 +23,15 @@ public String description() {
21
23
22
24
@ Override
23
25
public void configure (Subparser parser ) {
24
-
26
+ parser .addArgument ("type" ).nargs ("?" ).choices ("pastebin" , "file" , "literal" )
27
+ .setDefault ("pastebin" ) // type of input
28
+ .type (String .class ).dest ("type" ); // of type OutputStream
29
+ parser .addArgument ("input" ).nargs ("?" )
30
+ .type (String .class ).dest ("input" );
25
31
}
26
32
27
33
@ Override
28
34
public void run (Namespace details , Consumer <String > log ) {
29
-
35
+ controller . importPlugins ( new ImportInput ( details . get ( "type" ), details . get ( "input" )), log );
30
36
}
31
37
}
You can’t perform that action at this time.
0 commit comments