Skip to content

Commit 56c4625

Browse files
committed
chore(cli): Consistent naming for arguments
1 parent d116332 commit 56c4625

12 files changed

Lines changed: 40 additions & 41 deletions

src/main/java/dev/dochia/cli/core/DochiaMain.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ CommandLine.Help.ColorScheme colorScheme() {
113113

114114
private File findConfigFile(String[] args) {
115115
for (int i = 0; i < args.length - 1; i++) {
116-
if ("--configFile".equals(args[i])) {
116+
if ("--config".equals(args[i])) {
117117
return new File(args[i + 1]);
118-
} else if (args[i].startsWith("--configFile=")) {
118+
} else if (args[i].startsWith("--config=")) {
119119
return new File(args[i].split("=", 2)[1]);
120120
}
121121
}

src/main/java/dev/dochia/cli/core/args/ApiArguments.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@Singleton
1515
public class ApiArguments {
1616
@CommandLine.Option(
17-
names = {"--max-req-per-minute"}, paramLabel = "<max>",
17+
names = {"--max-requests-per-minute"}, paramLabel = "<max>",
1818
description = "Maximum number of requests per minute; this is useful when APIs have rate limiting implemented. Default: @|bold,underline ${DEFAULT-VALUE}|@",
1919
defaultValue = "10000")
2020
private int maxRequestsPerMinute = 10000;

src/main/java/dev/dochia/cli/core/args/AuthArguments.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ public class AuthArguments {
2020
description = "Location of the keystore holding certificates used when authenticating calls using one-way or two-way SSL")
2121
private String sslKeystore;
2222

23-
@CommandLine.Option(names = {"--ssl-keystore-pwd"}, paramLabel = "<password>",
23+
@CommandLine.Option(names = {"--ssl-keystore-password"}, paramLabel = "<password>",
2424
description = "The password of the sslKeystore")
2525
private String sslKeystorePwd;
2626

27-
@CommandLine.Option(names = {"--ssl-key-pwd"}, paramLabel = "<password>",
27+
@CommandLine.Option(names = {"--ssl-key-password"}, paramLabel = "<password>",
2828
description = "The password of the private key from the sslKeystore")
2929
private String sslKeyPwd;
3030

src/main/java/dev/dochia/cli/core/args/CheckArguments.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
@Getter
1313
@Setter
1414
public class CheckArguments {
15-
@CommandLine.Option(names = {"-A", "--check-headers"},
16-
description = "Run only Header ")
15+
@CommandLine.Option(names = {"-A", "--headers-only"},
16+
description = "Run only Header Playbooks")
1717
private boolean checkHeaders;
1818

19-
@CommandLine.Option(names = {"-F", "--check-fields"},
20-
description = "Run only Fields Test Case Playbooks")
19+
@CommandLine.Option(names = {"-F", "--fields-only"},
20+
description = "Run only Fields Playbooks")
2121
private boolean checkFields;
2222

23-
@CommandLine.Option(names = {"-B", "--check-body"},
24-
description = "Run only Body Test Case Playbooks")
23+
@CommandLine.Option(names = {"-B", "--body-only"},
24+
description = "Run only Body Playbooks")
2525
private boolean checkHttp;
2626

27-
@CommandLine.Option(names = {"-E", "--include-emojis"},
27+
@CommandLine.Option(names = {"-E", "--include-emojis"}, negatable = true, defaultValue = "true", fallbackValue = "true",
2828
description = "Include Emojis Test Case Playbooks. Default: @|bold,underline ${DEFAULT-VALUE}|@")
2929
private boolean includeEmojis = true;
3030
}

src/main/java/dev/dochia/cli/core/args/FilesArguments.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class FilesArguments {
3636
private Properties playbookConfigProperties;
3737
@Getter
3838

39-
@CommandLine.Option(names = {"--error-leaks-keywords", "-K"}, paramLabel = "<file>",
39+
@CommandLine.Option(names = {"--error-keywords", "-K"}, paramLabel = "<file>",
4040
description = "A properties file with error leaks keywords that will be used when processing responses to detect potential error leaks. If one of these keyword is found, the test case will be marked as error")
4141
@Setter
4242
private File errorLeaksKeywords;
@@ -51,7 +51,7 @@ public class FilesArguments {
5151
@Setter
5252
private List<String> params;
5353

54-
@CommandLine.Option(names = {"-U"}, paramLabel = "<string=object>",
54+
@CommandLine.Option(names = {"-U"}, paramLabel = "<name=value>",
5555
description = "Specifies the url/path params to be replaced in request paths")
5656
@Setter
5757
Map<String, Object> urlParamsArguments;
@@ -61,7 +61,7 @@ public class FilesArguments {
6161
@Setter
6262
private File headersFile;
6363

64-
@CommandLine.Option(names = {"-H"}, paramLabel = "<string=object>",
64+
@CommandLine.Option(names = {"-H", "--header"}, paramLabel = "<name=value>",
6565
description = "Specifies the headers that will be passed along with the request. When supplied it will be applied to ALL paths. For per-path control, the `--headers` arg must be used")
6666
@Setter
6767
Map<String, Object> headersMap;
@@ -71,26 +71,26 @@ public class FilesArguments {
7171
@Setter
7272
private File queryFile;
7373

74-
@CommandLine.Option(names = {"--paths-run-order"}, paramLabel = "<file>",
74+
@CommandLine.Option(names = {"--execution-order"}, paramLabel = "<file>",
7575
description = "A file with the order in which the paths will be executed. The paths are on each line. The order from file will drive the execution order")
7676
@Setter
7777
private File pathsOrderFile;
7878

79-
@CommandLine.Option(names = {"-Q"}, paramLabel = "<string=object>",
79+
@CommandLine.Option(names = {"-Q"}, paramLabel = "<name=value>",
8080
description = "Specifies additional query parameters that will be passed along with the request. This can be used to pass non-documented query params. When supplied it will be applied to ALL paths. " +
8181
"For per-path control, the `--query-params` argument must be used")
8282
@Setter
8383
Map<String, Object> queryParamsArguments;
8484

85-
@CommandLine.Option(names = {"--ref-data"}, paramLabel = "<file>",
85+
@CommandLine.Option(names = {"--reference-data"}, paramLabel = "<file>",
8686
description = "A YAML file with fields that must have a fixed value in order for requests to succeed. ")
8787
@Setter
8888
@Getter
8989
private File refDataFile;
9090

91-
@CommandLine.Option(names = {"-R"}, paramLabel = "<string=object>",
91+
@CommandLine.Option(names = {"-R"}, paramLabel = "<name=value>",
9292
description = "Specifies fields that must have a fixed value in order for requests to succeed. When supplied it will be applied to ALL paths. " +
93-
"For per-path control, the `--ref-data` argument must be used")
93+
"For per-path control, the `--reference-data` argument must be used")
9494
@Setter
9595
Map<String, Object> refDataArguments;
9696

src/main/java/dev/dochia/cli/core/args/IgnoreArguments.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void setBlackbox(boolean blackbox) {
3131
private List<String> ignoreResponseCodes;
3232

3333
@CommandLine.Option(names = {"--filter-codes", "--fc"}, paramLabel = "<code>",
34-
description = "Treat these response codes as success (not reported), even if the Playbook will typically report them as @|bold,underline warn|@ or @|bold,underline error|@ Equivalent to --i <codes> -k", split = ",")
34+
description = "Treat these response codes as success (not reported), even if the Playbook will typically report them as @|bold,underline warn|@ or @|bold,underline error|@", split = ",")
3535
public void setFilterResponseCodes(List<String> filterResponseCodes) {
3636
this.ignoreResponseCodes = filterResponseCodes;
3737
skipReportingForIgnoredArguments = true;

src/main/java/dev/dochia/cli/core/args/ProcessingArguments.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public class ProcessingArguments {
3434

3535
@CommandLine.Option(names = {"--use-examples"}, negatable = true,
3636
description = "When set to @|bold true|@, it will use request body examples, schema examples and primitive properties examples from the OpenAPI contract when available. " +
37-
"This is equivalent of using @|bold,underline --useRequestBodyExamples|@ @|bold,underline --useSchemaExamples|@ @|bold,underline --usePropertyExamples|@ @|bold,underline --useResponseBodyExamples|@." +
38-
"Default: @|bold,underline ${DEFAULT-VALUE}|@")
37+
"This is equivalent of using @|bold,underline --useRequestBodyExamples|@ @|bold,underline --useSchemaExamples|@ @|bold,underline --usePropertyExamples|@ @|bold,underline --useResponseBodyExamples|@.")
3938
@Setter
4039
private Boolean useExamples;
4140

@@ -63,7 +62,7 @@ public class ProcessingArguments {
6362
description = "The size of the strings used by the Playbooks sending large values like @|bold VeryLargeStringsPlaybook|@. Default: @|bold,underline ${DEFAULT-VALUE}|@")
6463
private int largeStringsSize = 40000;
6564

66-
@CommandLine.Option(names = {"--random-headers-number"}, paramLabel = "<number>",
65+
@CommandLine.Option(names = {"--random-headers-count"}, paramLabel = "<number>",
6766
description = "The number of random headers that will be sent by the @|bold LargeNumberOfRandomAlphanumericHeadersPlaybook and LargeNumberOfRandomHeadersPlaybook|@. Default: @|bold,underline ${DEFAULT-VALUE}|@")
6867
private int randomHeadersNumber = 10000;
6968

@@ -78,7 +77,7 @@ public class ProcessingArguments {
7877
private String contentType;
7978

8079
@Setter
81-
@CommandLine.Option(names = {"--one-of-selection", "--any-of-selection"}, paramLabel = "<string=string>",
80+
@CommandLine.Option(names = {"--schema-discriminator"}, paramLabel = "<name=value>",
8281
description = "A @|bold name=value|@ list of discriminator names and values that can be use to filter request payloads when objects use oneOf or anyOf definitions" +
8382
" which result in multiple payloads for a single endpoint and http method")
8483
Map<String, String> xxxOfSelections;
@@ -94,20 +93,20 @@ public class ProcessingArguments {
9493
private boolean allowInvalidEnumValues;
9594

9695
@Setter
97-
@CommandLine.Option(names = {"--limit-xxx-of-combinations"}, paramLabel = "<max>",
96+
@CommandLine.Option(names = {"--max-schema-combinations"}, paramLabel = "<max>",
9897
description = "Max number of anyOf/oneOf combinations. Default: @|bold,underline ${DEFAULT-VALUE}|@")
9998
private int limitXxxOfCombinations = 20;
10099

101100
@Setter
102-
@CommandLine.Option(names = {"--limit-tested-fields"}, paramLabel = "<max>",
101+
@CommandLine.Option(names = {"--max-tested-fields"}, paramLabel = "<max>",
103102
description = "Max number of request fields to be tested. Default: @|bold,underline ${DEFAULT-VALUE}|@ which means all fields will be tested")
104103
private int limitNumberOfFields;
105104

106105
@CommandLine.Option(names = {"--use-defaults"}, negatable = true, defaultValue = "true", fallbackValue = "true",
107106
description = "If set to @|bold true|@, it will use default values (if set) when generating examples. Default: @|bold,underline ${DEFAULT-VALUE}|@")
108107
private boolean useDefaults = true;
109108

110-
@CommandLine.Option(names = {"--resolve-xxx-of-responses"},
109+
@CommandLine.Option(names = {"--resolve-response-combinations"},
111110
description = "If set to @|bold true|@, it will resolve oneOf/anyOf combinations also for responses. Default: @|bold,underline ${DEFAULT-VALUE}|@")
112111
private boolean resolveXxxOfCombinationForResponses;
113112

src/main/java/dev/dochia/cli/core/args/ReportingArguments.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
public class ReportingArguments {
1919
private final PrettyLogger logger = PrettyLoggerFactory.getLogger(ReportingArguments.class);
2020

21-
@CommandLine.Option(names = {"--print-execution-statistics"},
21+
@CommandLine.Option(names = {"--execution-stats"},
2222
description = "Print a summary of execution times for each endpoint and HTTP method. By default this will print a summary for each endpoint: max, min and average. Detailed reports can be enabled using @|bold --printDetailedExecutionStatistics|@")
2323
private boolean printExecutionStatistics;
2424

25-
@CommandLine.Option(names = {"--print-detailed-execution-statistics"},
25+
@CommandLine.Option(names = {"--detailed-execution-stats"},
2626
description = "Print detailed execution statistics with execution times for each request")
2727
private boolean printDetailedExecutionStatistics;
2828

@@ -50,7 +50,7 @@ public class ReportingArguments {
5050
description = "Indicates if coloured output is enabled in the console.")
5151
private boolean color = true;
5252

53-
@CommandLine.Option(names = {"--max-response-time-in-ms"}, paramLabel = "<max>",
53+
@CommandLine.Option(names = {"--max-response-time"}, paramLabel = "<ms>",
5454
description = "Sets a response time limit in milliseconds. If responses take longer than the provided value, they will get marked as @|bold error|@ with reason @|underline Response time exceeds max|@." +
5555
" The response time limit check is triggered only if the test case is considered successful i.e. response matches Playbook expectations")
5656
private int maxResponseTime;

src/main/java/dev/dochia/cli/core/command/DochiaCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
footerHeading = "%n@|bold,underline Examples:|@%n",
5151
footer = {
5252
" Run in blackbox mode and only report 500 http error codes:",
53-
" dochia test -c openapi.yml -s http://localhost:8080 -b -k",
53+
" dochia test -c openapi.yml -s http://localhost:8080 -b",
5454
"",
5555
" Run with authentication headers from an environment variable called TOKEN:",
5656
" dochia test -c openapi.yml -s http://localhost:8080 -H API-Token=$$TOKEN"

src/main/java/dev/dochia/cli/core/command/TestCommand.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
footerHeading = "%n@|bold,underline Examples:|@%n",
6161
footer = {
6262
" Run in blackbox mode and only report 500 http error codes:",
63-
" dochia test -c openapi.yml -s http://localhost:8080 -b -k",
63+
" dochia test -c openapi.yml -s http://localhost:8080 -b",
6464
"",
6565
" Run with authentication headers from an environment variable called TOKEN:",
6666
" dochia test -c openapi.yml -s http://localhost:8080 -H API-Token=$$TOKEN"
@@ -94,27 +94,27 @@ public class TestCommand implements Runnable, CommandLine.IExitCodeGenerator {
9494
AuthArguments authArgs;
9595

9696
@Inject
97-
@CommandLine.ArgGroup(heading = "%n@|bold,underline Check Options:|@%n", exclusive = false)
97+
@CommandLine.ArgGroup(heading = "%n@|bold,underline Test Control Options:|@%n", exclusive = false)
9898
CheckArguments checkArgs;
9999

100100
@Inject
101-
@CommandLine.ArgGroup(heading = "%n@|bold,underline Files Options:|@%n", exclusive = false)
101+
@CommandLine.ArgGroup(heading = "%n@|bold,underline ConfigurationFiles Options:|@%n", exclusive = false)
102102
FilesArguments filesArguments;
103103

104104
@Inject
105-
@CommandLine.ArgGroup(heading = "%n@|bold,underline Filter Options:|@%n", exclusive = false)
105+
@CommandLine.ArgGroup(heading = "%n@|bold,underline Filter and Selection Options:|@%n", exclusive = false)
106106
FilterArguments filterArguments;
107107

108108
@Inject
109-
@CommandLine.ArgGroup(heading = "%n@|bold,underline Ignore Options:|@%n", exclusive = false)
109+
@CommandLine.ArgGroup(heading = "%n@|bold,underline Response Handling Options:|@%n", exclusive = false)
110110
IgnoreArguments ignoreArguments;
111111

112112
@Inject
113-
@CommandLine.ArgGroup(heading = "%n@|bold,underline Processing Options:|@%n", exclusive = false)
113+
@CommandLine.ArgGroup(heading = "%n@|bold,underline Processing and GenerationOptions:|@%n", exclusive = false)
114114
ProcessingArguments processingArguments;
115115

116116
@Inject
117-
@CommandLine.ArgGroup(heading = "%n@|bold,underline Reporting Options:|@%n", exclusive = false)
117+
@CommandLine.ArgGroup(heading = "%n@|bold,underline Reporting and Output Options:|@%n", exclusive = false)
118118
ReportingArguments reportingArguments;
119119

120120
@CommandLine.Spec

0 commit comments

Comments
 (0)