Ejemplo n.º 1
0
        private static int Execute <TOptions>(
            AbstractCommand <TOptions> command,
            AbstractCommandLineOptions options) where TOptions : AbstractCommandOptions
        {
#if DEBUG
            if (ShouldLog(Verbosity.Diagnostic))
            {
                WriteLine("--- RAW PARAMETERS ---", Verbosity.Diagnostic);
                DiagnosticWriter.WriteParameters(options);
                WriteLine("--- END OF RAW PARAMETERS ---", Verbosity.Diagnostic);

                WriteLine("--- APP PARAMETERS ---", Verbosity.Diagnostic);
                command.Options.WriteDiagnostic();
                WriteLine("--- END OF APP PARAMETERS ---", Verbosity.Diagnostic);
            }
#endif
            CommandResult result = command.Execute();

            switch (result)
            {
            case CommandResult.Success:
                return(ExitCodes.Match);

            case CommandResult.NoMatch:
                return(ExitCodes.NoMatch);

            case CommandResult.Fail:
            case CommandResult.Canceled:
                return(ExitCodes.Error);

            default:
                throw new InvalidOperationException($"Unknown enum value '{result}'.");
            }
        }
Ejemplo n.º 2
0
 protected override void WriteDiagnosticCore()
 {
     DiagnosticWriter.WriteRenameCommand(this);
 }
Ejemplo n.º 3
0
 protected override void WriteDiagnosticCore()
 {
     DiagnosticWriter.WriteListPatternsCommand(this);
 }