Skip to content

Commit 9fe075d

Browse files
committed
more work on the CLI instructions
1 parent 8d6b37d commit 9fe075d

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

tools/src/main/java/com/github/jsonldjava/tools/Playground.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ public RDFFormat convert(String arg0) {
9595
if(formats.containsKey(formatName)) {
9696
return formats.get(formatName);
9797
}
98-
throw new ValueConversionException("Format was not known: " + arg0);
98+
throw new ValueConversionException("Format was not known: " + arg0 + " (Valid values are: " + formats + ")"
99+
);
99100
}
100101

101102
@Override
@@ -109,7 +110,7 @@ public Class<RDFFormat> valueType() {
109110
}
110111
})
111112
.describedAs(
112-
"The output file format to use. Defaults to nquads.");
113+
"The output file format to use. Defaults to nquads. Valid values are: " + formats);
113114

114115
final OptionSpec<String> processingOption = parser.accepts("process")
115116
.withRequiredArg()
@@ -121,7 +122,8 @@ public String convert(String value) {
121122
if(getProcessingOptions().contains(value.toLowerCase())) {
122123
return value.toLowerCase();
123124
}
124-
throw new ValueConversionException("Processing option was not known: " + value);
125+
throw new ValueConversionException("Processing option was not known: " + value
126+
+ " (Valid values are: " + getProcessingOptions() + ")");
125127
}
126128

127129
@Override
@@ -134,7 +136,7 @@ public String valuePattern() {
134136
return null;
135137
}
136138
})
137-
.describedAs("The processing to perform. One of: " + getProcessingOptions().toString());
139+
.describedAs("The processing to perform. Valid values are: " + getProcessingOptions().toString());
138140

139141
final OptionSpec<String> outputForm = parser.accepts("outputForm")
140142
.withOptionalArg()
@@ -146,7 +148,7 @@ public String convert(String value) {
146148
if(outputForms.contains(value.toLowerCase())) {
147149
return value.toLowerCase();
148150
}
149-
throw new ValueConversionException("Output form was not known: " + value);
151+
throw new ValueConversionException("Output form was not known: " + value + " (Valid values are: " + outputForms + ")");
150152
}
151153

152154
@Override
@@ -159,7 +161,7 @@ public Class<String> valueType() {
159161
return String.class;
160162
}
161163
})
162-
.describedAs("The way to output the results from fromRDF. Defaults to expanded.");
164+
.describedAs("The way to output the results from fromRDF. Defaults to expanded. Valid values are: " + outputForms);
163165

164166
OptionSet options = null;
165167

0 commit comments

Comments
 (0)