Beispiel #1
0
        public static int Run()
        {
            try
            {
                var command = new CommandLine(Environment.CommandLine);

                var args = new ProcessCommandLineArgs
                {
                    Command  = command,
                    Handlers = GetHandlers().ToArray(),
                    Writer   = new IndentedTextWriter(System.Console.Out, "  ")
                };
                foreach (var handler in args.Handlers)
                {
                    if (handler.Process(args))
                    {
                        return(0);
                    }
                }

                System.Console.WriteLine();
                return(-1);
            }
            catch (Exception ex)
            {
                Log.ErrorFormat("An error happened: {0}", ex);
                return(0);
            }
        }
Beispiel #2
0
        public static int Run()
        {
            var command = new CommandLine(Environment.CommandLine);

            var args = new ProcessCommandLineArgs
            {
                Command  = command,
                Handlers = GetHandlers().ToArray(),
                Writer   = new IndentedTextWriter(System.Console.Out, "  ")
            };

            foreach (var handler in args.Handlers)
            {
                if (handler.Process(args))
                {
                    return(0);
                }
            }
            System.Console.WriteLine();
            return(-1);
        }
 public abstract bool Process(ProcessCommandLineArgs args);
 public abstract void GetHelp(ProcessCommandLineArgs args);