Github user hanm commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/619#discussion_r216841877
  
    --- Diff: src/java/main/org/apache/zookeeper/server/SnapshotFormatter.java 
---
    @@ -34,79 +36,133 @@
     import org.apache.yetus.audience.InterfaceAudience;
     import org.apache.zookeeper.data.StatPersisted;
     import org.apache.zookeeper.server.persistence.FileSnap;
    +import org.apache.zookeeper.server.persistence.Util;
    +import org.json.simple.JSONValue;
    +
    +import static 
org.apache.zookeeper.server.persistence.FileSnap.SNAPSHOT_FILE_PREFIX;
     
     /**
      * Dump a snapshot file to stdout.
    + *
    + * For JSON format, followed https://dev.yorhel.nl/ncdu/jsonfmt
      */
     @InterfaceAudience.Public
     public class SnapshotFormatter {
     
    +    private static Integer INODE_IDX = 1000;
    +
         /**
          * USAGE: SnapshotFormatter snapshot_file
          */
         public static void main(String[] args) throws Exception {
    -        if (args.length != 1) {
    -            System.err.println("USAGE: SnapshotFormatter snapshot_file");
    +        String snapshotFile = null;
    +        boolean dumpData = false;
    +        boolean dumpJson = false;
    +
    +        int i;
    +        for (i = 0; i < args.length; i++) {
    +            if (args[i].equals("-d")) {
    +                dumpData = true;
    +            } else if (args[i].equals("-json")) {
    +                dumpJson = true;
    +            } else {
    --- End diff --
    
    so it's possible to specify both `-d` and `-json` option, which will print 
a mix of dump data and json data. Is this intended?


---

Reply via email to