Exemplo n.º 1
0
        static void Main(string[] args)
        {
            String json = null;
            String jlt  = null;

            Parser.Default.ParseArguments <Options>(args).WithParsed <Options>(o => {
                if (o.JltPath != null)
                {
                    jlt = ReadFile(o.JltPath);
                }
                else if (o.JltString != null)
                {
                    jlt = o.JltString;
                    if (o.Verbose)
                    {
                        Console.WriteLine("jlt:");
                        Console.WriteLine(jlt);
                    }
                }
                if (o.JsonPath != null)
                {
                    json = ReadFile(o.JsonPath);
                }
                else if (o.JsonString != null)
                {
                    json = o.JsonString;
                    if (o.Verbose)
                    {
                        Console.WriteLine("json:");
                        Console.WriteLine(json);
                    }
                }
                JsonLTInterpreter interpreter = new JsonLTInterpreter();
                string result = interpreter.Run(json, jlt, o.AsString, o.Pretty);
                Console.WriteLine(result);
            });
        }