Uses the stderr stream to inform the user about the progress of tasks.
Inheritance: TaskHandlerBase
Exemple #1
0
 /// <summary>
 /// Runs the application in command-line mode with special-case handling for retroactively attached Windows consoles.
 /// </summary>
 /// <param name="args">The command-line arguments passed to the application.</param>
 /// <returns>The exit status code to end the process with.</returns>
 private static ExitCode RunCliWindows(string[] args)
 {
     using (var handler = new CliTaskHandler())
     {
         try
         {
             Console.WriteLine();
             return Run(args, handler, gui: false);
         }
         finally
         {
             if (handler.Verbosity != Verbosity.Batch)
             {
                 Console.WriteLine();
                 Console.Write(Environment.CurrentDirectory + @">");
             }
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static int Main(string[] args)
        {
            NetUtils.ApplyProxy();

            // Automatically show help for missing args
            if (args == null) args = new string[0];
            if (args.Length == 0) args = new[] {"--help"};

            try
            {
                using (var handler = new CliTaskHandler())
                {
                    var command = (args.FirstOrDefault() == "capture")
                        ? (ICommand)new CaptureCommand(args.Skip(1), handler)
                        : new PublishCommand(args, handler);
                    return (int)command.Execute();
                }

            }
                #region Error hanlding
            catch (OperationCanceledException)
            {
                return (int)ExitCode.UserCanceled;
            }
            catch (ArgumentException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.InvalidArguments;
            }
            catch (OptionException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.InvalidArguments;
            }
            catch (WebException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.WebError;
            }
            catch (InvalidDataException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.InvalidData;
            }
            catch (IOException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.IOError;
            }
            catch (UnauthorizedAccessException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.AccessDenied;
            }
            catch (DigestMismatchException ex)
            {
                Log.Info(ex.LongMessage);
                Log.Error(ex);
                return (int)ExitCode.DigestMismatch;
            }
            catch (KeyNotFoundException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.InvalidArguments;
            }
            catch (WrongPassphraseException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.InvalidArguments;
            }
            catch (NotSupportedException ex)
            {
                Log.Error(ex);
                return (int)ExitCode.NotSupported;
            }
            #endregion
        }
Exemple #3
0
 /// <summary>
 /// Runs the application in command-line mode.
 /// </summary>
 /// <param name="args">The command-line arguments passed to the application.</param>
 /// <returns>The exit status code to end the process with.</returns>
 private static ExitCode RunCli(string[] args)
 {
     using (var handler = new CliTaskHandler())
         return Run(args, handler, gui: false);
 }