static int Main(string[] args)
        {
            int result = -1;

            string temp;
            var wait = ArgumentList.Remove(ref args, "wait", out temp);
       
            try
            {
                // Construct the CommandInterpreter and initialize
                ICommandInterpreter ci = new CommandInterpreter(
                    DefaultCommands.Help |
                    DefaultCommands.IORedirect |
                    0,
                    // Add the types to use static members
                    typeof(Filters), 
                    // Add classes to use instance members
                    typeof(Commands)
                    );

                // If you want to hide some options/commands at runtime you can:
                foreach (var name in new[] {"prompt", "errorlevel"})
                {
                    IOption opt;
                    if (ci.TryGetOption(name, out opt))
                        opt.Visible = false;
                }
                foreach (var name in new[] {"echo", "set", "get"})
                {
                    ICommand opt;
                    if (ci.TryGetCommand(name, out opt))
                        opt.Visible = false;
                }

                // Apply all DefaultValue values to properties
                ci.SetDefaults();

                // If we have arguments, just run with those arguments...
                if (args.Length > 0)
                    ci.Run(args);
                else
                {
                    //When run without arguments you can either display help:
                    //ci.Help(null);
                    //... or run the interpreter:
                    ci.Run(Console.In);
                }

                result = ci.ErrorLevel;
            }
            catch (OperationCanceledException)
            { result = 3; }
            catch (ApplicationException ex)
            {
                Trace.TraceError("{0}", ex);
                Console.Error.WriteLine(ex.Message);
                result = 1;
            }
            catch (Exception ex)
            {
                Trace.TraceError("{0}", ex);
                Console.Error.WriteLine(ex.ToString());
                result = 2;
            }
            finally
            {
                if (wait)
                {
                    Console.WriteLine("Exited with result = {0}, Press Enter to quit.", result);
                    Console.ReadLine();
                }
            }

            return Environment.ExitCode = result;
        }