package com.acme.calculator.main;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.math.MathContext;
import java.util.Arrays;

/**
 * Entry point for this program to calculate the value of an expression provided on the command-line.
 *
 * The calculated result is printed to stdout.
 *
 * Future option: could add more cmd-line parameters to allow passing the desired precision & RoundingMode.
 *
 * Created by pturcotte on 1/8/16.
 */
public class Startup {
    private static final Logger logger = LogManager.getLogger(Startup.class);
    static String NEWLINE = System.lineSeparator();

    /**
     * main() needed to run this program from the command line.
     * Verifies command-line arguments and prints usage to stdout
     * if the arguments are not as expected.
     *
     * @param args command-line arguments passed to this program
     */
    public static void main(final String[] args) {
        logger.info("main()");
        logger.debug("main(): arguments: {}", Arrays.asList(args));

        if (args.length == 1) {
            Calculator parser = new Calculator(MathContext.DECIMAL128);
            final String expression = args[0];
            final String result = parser.calculate(expression);
            logger.debug("Expression: '{}' -> result: '{}'", expression, result);
            System.out.println(result);
        } else {
            showUsage(args);
        }
    }

    /**
     * Prints usage information to stdout
     *
     * @param args command-line arguments passed to this program
     */
    static void showUsage(final String [] args) {
        logger.debug("showUsage()");
        final String className = Startup.class.getName();
        System.out.println(String.format("Unexpected number of arguments (%d)", args.length));
        System.out.println(String.format("usage:%s\tjava -cp simple.expression.calculator-1.0-SNAPSHOT.jar %s \"[expression]\" ",NEWLINE, className));
        System.out.println(String.format("example:%s\tjava -cp simple.expression.calculator-1.0-SNAPSHOT.jar %s \"let(a,7,add(a,div(10,2)))\"",NEWLINE, className));
    }
}

@@ -575,24 +575,121 @@
 tup.class);%0A
+    private static final String JAR_FILE_NAME = %22simple.expression.calculator-1.0-SNAPSHOT.jar%22;%0A
     static S
@@ -1978,53 +1978,10 @@
 -cp 
+%25
 s
-imple.expression.calculator-1.0-SNAPSHOT.jar
  %25s 
@@ -1999,32 +1999,47 @@
 on%5D%5C%22 %22,NEWLINE,
+ JAR_FILE_NAME,
  className));%0A  
@@ -2103,53 +2103,10 @@
 -cp 
+%25
 s
-imple.expression.calculator-1.0-SNAPSHOT.jar
  %25s 
@@ -2144,16 +2144,31 @@
 NEWLINE,
+ JAR_FILE_NAME,
  classNa

put example jar filename into constant