예제 #1
0
파일: Program.cs 프로젝트: JosefPihrt/Orang
        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}'.");
            }
        }
예제 #2
0
 protected override void WriteDiagnosticCore()
 {
     DiagnosticWriter.WriteRenameCommand(this);
 }
예제 #3
0
 protected override void WriteDiagnosticCore()
 {
     DiagnosticWriter.WriteListPatternsCommand(this);
 }