package tdl.record.sourcecode;

import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import tdl.record.sourcecode.snapshot.file.SnapshotFileSegment;
import tdl.record.sourcecode.snapshot.file.SnapshotsFileReader;

@Parameters(commandDescription = "List snapshots in the file.")
public class ListCommand extends Command {

    @Parameter(names = {"-i", "--input"}, description = "The SRCS input file.", required = true)
    private String inputFilePath;

    @Override
    public void run() {
        File file = Paths.get(inputFilePath).toFile();
        try (SnapshotsFileReader reader = new SnapshotsFileReader(file)) {
            while (reader.hasNext()) {
                SnapshotFileSegment segment = reader.next();
                printSnapshot(segment);
            }
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }

    private void printSnapshot(SnapshotFileSegment segment) {

    }
}

@@ -181,16 +181,48 @@
 .Paths;%0A
+import java.text.MessageFormat;%0A
 import t
@@ -277,16 +277,16 @@
 egment;%0A
-
 import t
@@ -746,24 +746,51 @@
 er(file)) %7B%0A
+            int index = 0;%0A
             
@@ -914,17 +914,49 @@
 (segment
-)
+, index);%0A                index++
 ;%0A      
@@ -1117,19 +1117,257 @@
  segment
-) %7B
+, int index) %7B%0A        String message = MessageFormat.format(%0A                %22Snapshot #%7B0,number%7D: %5Cn%22%0A                + %22%5CtTime %7B1,date%7D %7B1,time%7D%22,%0A                index, segment.getTimestampAsDate());%0A        System.out.println(message);
 %0A%0A    %7D%0A

Add list command.