|
3 | 3 | import com.thecoderscorner.menu.domain.state.MenuTree;
|
4 | 4 | import com.thecoderscorner.menu.editorui.MenuEditorApp;
|
5 | 5 | import com.thecoderscorner.menu.editorui.generator.CodeGeneratorOptions;
|
| 6 | +import com.thecoderscorner.menu.editorui.generator.ProjectSaveLocation; |
6 | 7 | import com.thecoderscorner.menu.editorui.generator.core.CreatorProperty;
|
7 | 8 | import com.thecoderscorner.menu.editorui.generator.plugin.CodePluginItem;
|
8 | 9 | import com.thecoderscorner.menu.editorui.generator.plugin.DefaultXmlPluginLoader;
|
@@ -50,6 +51,9 @@ public class CodeGeneratorCommand implements Callable<Integer> {
|
50 | 51 | @CommandLine.Option(names = {"-v", "--verbose"}, description = "verbose logging")
|
51 | 52 | private boolean verbose;
|
52 | 53 |
|
| 54 | + @CommandLine.Option(names = {"-o", "--output-dir"}, description = "output directory") |
| 55 | + private String outputDir; |
| 56 | + |
53 | 57 | @Override
|
54 | 58 | public Integer call() {
|
55 | 59 | try {
|
@@ -89,7 +93,15 @@ public Integer call() {
|
89 | 93 | plugins.add(getPluginOrDefault(allPlugins, project.getOptions().getLastThemeUuid(), DEFAULT_THEME_PLUGIN, propMap));
|
90 | 94 | }
|
91 | 95 |
|
92 |
| - var location = Paths.get(loadedProjectFile.getParent()); |
| 96 | + // Override output dir settings from project file if specified as a parameter. |
| 97 | + Path location; |
| 98 | + location = (outputDir != null) |
| 99 | + ? Paths.get(outputDir) |
| 100 | + : Paths.get(loadedProjectFile.getParent()); |
| 101 | + if (outputDir != null) { |
| 102 | + project.getOptions().setSaveLocation(ProjectSaveLocation.ALL_TO_CURRENT); |
| 103 | + } |
| 104 | + |
93 | 105 | codeGen.setLoggerFunction((level, s) -> {
|
94 | 106 | if(verbose) System.out.format("Gen: %s: %s\n", level, s);
|
95 | 107 | });
|
|
0 commit comments