package poml.cmd;

import java.lang.management.ManagementFactory;

public class Msg {
  StringBuilder b;
  public Msg(StringBuilder b) { this.b = b; }
  public Msg add(Object msg) { b.append(msg); return this; }
  public Msg nl() { b.append(System.lineSeparator()); return this; }
  public void out() { System.out.print(b.toString()); }
  public void err() { System.err.print(b.toString()); }
  public static Msg init() { return new Msg(new StringBuilder()); }

  public static void start(String pomlPath) {
    Msg.init(
      ).add("[POML:INFO] Processing \""
      ).add(pomlPath).add("\"").nl(
    ).out();
  }
  public static void error(Throwable e, String xmlPath) {
    Msg.init(
      ).add("[POML:ERROR] ").add(e.getMessage()).nl(
      ).add("[POML:ERROR] Could not generate \""
      ).add(xmlPath).add("\"").nl(
    ).err();
  }
  public static void end(String xmlPath) {
    Msg.init(
      ).add("[POML:INFO] Genarated \""
      ).add(xmlPath).add("\" @").add(
        ManagementFactory
          .getRuntimeMXBean().getUptime()
      ).add("ms").nl(
    ).out();
  }
}

@@ -544,29 +544,20 @@
 FO%5D 
-Processing %5C%22%22%0A      
+Converting %22
 ).ad
@@ -564,34 +564,24 @@
 d(pomlPath).
-add(%22%5C%22%22).
 nl(%0A    ).ou
@@ -754,27 +754,16 @@
 not 
-generate %5C%22%22%0A      
+create %22
 ).ad
@@ -777,18 +777,8 @@
 th).
-add(%22%5C%22%22).
 nl(%0A
@@ -880,20 +880,16 @@
 FO%5D 
-Genar
+Cre
 ated 
-%5C%22
 %22%0A  
@@ -916,10 +916,8 @@
 dd(%22
-%5C%22
  @%22)

Update cmd messages.