Exemple #1
0
        private static int Main(string[] args)
        {
            if (Console.IsOutputRedirected)
            {
                Console.OutputEncoding = Encoding.UTF8;
            }

            var app = new CommandLineApplication()
            {
                FullName = Resources.CommandFullName,
                Name     = Resources.CommandFullName,
            };

            new GetDocumentCommand().Configure(app);

            try
            {
                return(app.Execute(args));
            }
            catch (Exception ex)
            {
                if (ex is CommandException || ex is CommandParsingException)
                {
                    Reporter.WriteVerbose(ex.ToString());
                }
                else
                {
                    Reporter.WriteInformation(ex.ToString());
                }

                Reporter.WriteError(ex.Message);

                return(1);
            }
        }
Exemple #2
0
        private static int Main(string[] args)
        {
            var app = new CommandLineApplication(throwOnUnexpectedArg: false)
            {
                FullName = Resources.CommandFullName,
                Name     = Resources.CommandFullName,
            };

            new InvokeCommand().Configure(app);

            try
            {
                return(app.Execute(args));
            }
            catch (Exception ex)
            {
                if (ex is CommandException || ex is CommandParsingException)
                {
                    Reporter.WriteVerbose(ex.ToString());
                }
                else
                {
                    Reporter.WriteInformation(ex.ToString());
                }

                Reporter.WriteError(ex.Message);

                return(1);
            }
        }