Skip to content

Commit

Permalink
more nits
Browse files Browse the repository at this point in the history
  • Loading branch information
Hafthor committed Jun 2, 2024
1 parent c624408 commit b2edad1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/hafthor/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import java.util.List;

public class Command {
String errorMessage, inputFile, outputFile;
final String inputFile, outputFile;
String errorMessage;
boolean isGzip;
List<String> fields;

Expand Down Expand Up @@ -40,7 +41,7 @@ private String parseOptions(final String[] args) {
if ("-f".equals(arg)) {
if (next == null || next.isEmpty())
return "missing field definitions";
fields = Arrays.stream(next.split(",")).toList();
fields = Arrays.stream(next.split(",")).map(f -> f.trim()).toList();
i++;
} else if ("-g".equals(arg))
isGzip = true;
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/com/hafthor/HelpCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ protected HelpCommand() {

@Override
public int execute() {
System.out.println("zsvutil syntax:");
System.out.println(" zsvutil import/export [options] inputfile outputfile");
System.out.println("options:");
System.out.println(" -g - export: gzip the output json file / import: gunzip the input json file");
System.out.println(" -f [string] - fields, default is from contents of input file");
System.out.println("example: # converts customers.json to customers.zsv with default options");
System.out.println(" zsvutil import customers.json customers.zsv");
System.out.println("example: # converts customers.zsv to customers.json.gz with gzip");
System.out.println(" zsvutil export -g customers.zip customers.tsv.gz");
System.out.println("Note that, at present, zsvutil requires enough memory to hold the entire uncompressed input file in memory.");
System.out.println("Also note that this utility only supports the base specification of zsv and does not support the extended features.");
System.out.println("zsvutil syntax:\n" +
" zsvutil import/export [options] inputfile outputfile\n" +
"options:\n" +
" -g - export: gzip the output json file / import: gunzip the input json file\n" +
" -f [string] - fields, default is from contents of input file\n" +
"example: # converts customers.json to customers.zsv with default options\n" +
" zsvutil import customers.json customers.zsv\n" +
"example: # converts customers.zsv to customers.json.gz with gzip\n" +
" zsvutil export -g customers.zip customers.tsv.gz\n" +
"Note that, at present, zsvutil requires enough memory to hold the entire uncompressed input file in memory.\n" +
"Also note that this utility only supports the base specification of zsv and does not support the extended features.\n");
return 0;
}
}

0 comments on commit b2edad1

Please sign in to comment.