Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added command line options to LogDecoder #87

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions LogConverter/src/org/frc4931/utils/LogDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,28 @@
import java.util.Arrays;

public class LogDecoder {
// TODO Use terminal arguments for in and out file
public static void main(String[] args) {
String inFile = "robot.log";
String outFile = "robot.csv";

for (int i = 0; i < args.length; i++) {
switch (args[i]) {
case "-in":
inFile = args[++i];
break;
case "-out":
outFile = args[++i];
break;
default:
System.out.println("Usage: LogDecoder [-in INFILE] [-out OUTFILE]");
System.exit(1);
}
}

try {
File file = new File("robot.log");
File file = new File(inFile);
DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
File out = new File("robot.csv");
File out = new File(outFile);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we name the output file the same name as the input if a specific output isn't specified?

BufferedWriter writer = new BufferedWriter(new FileWriter(out));

// Verify Header
Expand Down