diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index fb1e5658f..9f9f58698 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -54,7 +54,7 @@ When manually writing profiles, we recommend using a text editor which can valid Now place the `generator.jar` file (downloaded from the [GitHub releases page](https://github.com/finos/datahelix/releases/)) in the same folder as the profile, open up a terminal, and execute the following: ``` -$ java -jar generator.jar generate --max-rows=100 --replace --profile-file=profile.json --output-path=output.csv +$ java -jar generator.jar --max-rows=100 --replace --profile-file=profile.json --output-path=output.csv ``` The generator is a command line tool which reads a profile, and outputs data in CSV or JSON format. The `--max-rows=100` option tells the generator to create 100 rows of data, and the `--replace` option tells it to overwrite previously generated files. The compulsory `--profile-file` option specifies the name of the input profile, and the `--output-path` option specifies the location to write the output to. In `generate` mode `--output-path` is optional; the generator will default to standard output if it is not supplied. By default the generator outputs progress, in rows per second, to the standard error output. This can be useful when generating large volumes of data. @@ -248,7 +248,7 @@ The mode is specified via the `--generation-type` option. The generator has been designed to be fast and efficient, allowing you to generate large quantities of test and simulation data. If you supply a large number for the `--max-rows` option, the data will be streamed to the output file, with the progress / velocity reported during generation. ``` -$ java -jar generator.jar generate --max-rows=10000 --replace --profile-file=profile.json --output-path=output.csv +$ java -jar generator.jar --max-rows=10000 --replace --profile-file=profile.json --output-path=output.csv Generation started at: 16:41:44 Number of rows | Velocity (rows/sec) | Velocity trend diff --git a/docs/UserGuide.md b/docs/UserGuide.md index c5c52851e..9db320b74 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -768,7 +768,7 @@ Profiles can be run against a jar using the command line. Currently the only mode fully supported by the data helix is generate mode. An example command would be something like -`java -jar generator.jar generate --max-rows=100 --replace --profile-file=profile.json --output-path=output.csv` +`java -jar generator.jar --max-rows=100 --replace --profile-file=profile.json --output-path=output.csv` ### Command Line Arguments for Generate Mode
diff --git a/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/App.java b/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/App.java index 2468c7f50..89aab48aa 100644 --- a/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/App.java +++ b/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/App.java @@ -27,20 +27,7 @@ name = "datahelix", version = { ProfileConfiguration.PROFILE_SCHEMA_VERSION_TEXT }) public class App implements Runnable { - @CommandLine.Option( - names = { CommonOptionInfo.VERSION_SHORT_OPTION, CommonOptionInfo.VERSION_LONG_OPTION }, - versionHelp = true, - description = CommonOptionInfo.VERSION_DESCRIPTION) - boolean versionRequested; - - @CommandLine.Option( - names = { CommonOptionInfo.HELP_SHORT_OPTION, CommonOptionInfo.HELP_LONG_OPTION }, - usageHelp = true, - description = CommonOptionInfo.HELP_DESCRIPTION) - private boolean help; - - private static final CommandLine picoCliCommandLine = new CommandLine(new App()) - .addSubcommand("generate", new GenerateCommandLine()) + private static final CommandLine picoCliCommandLine = new CommandLine(new GenerateCommandLine()) .addSubcommand("violate", new ViolateCommandLine()) .setCaseInsensitiveEnumValuesAllowed(true); diff --git a/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/generate/GenerateCommandLine.java b/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/generate/GenerateCommandLine.java index 205f20ed9..07a6dcbc8 100644 --- a/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/generate/GenerateCommandLine.java +++ b/orchestrator/src/main/java/com/scottlogic/datahelix/generator/orchestrator/generate/GenerateCommandLine.java @@ -43,7 +43,7 @@ * This class holds the generate specific command line options. */ @picocli.CommandLine.Command( - name = "generate", + name = "", description = "Produces data using any options provided.", descriptionHeading = "%nDescription:%n", parameterListHeading = "%nParameters:%n", @@ -67,6 +67,13 @@ private void checkForAlphaGenerationDataTypes() { } } + @CommandLine.Option( + names = { "generate" }, + description = "Included for backward compatibility with command-based invocation", + hidden = true + ) + boolean generateCommandUsed; + @CommandLine.Option( names = { CommonOptionInfo.VERSION_SHORT_OPTION, CommonOptionInfo.VERSION_LONG_OPTION }, versionHelp = true, diff --git a/orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/endtoend/JarExecuteTests.java b/orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/endtoend/JarExecuteTests.java index 591b67b64..446f71b0b 100644 --- a/orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/endtoend/JarExecuteTests.java +++ b/orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/endtoend/JarExecuteTests.java @@ -62,7 +62,6 @@ private Process setupProcess(final String profile) throws IOException { "java", "-jar", "build/libs/generator.jar", - "generate", profile, "--max-rows=1", "--quiet");