Exemplo n.º 1
0
        public LogOptions ParseCommandLine(Arguments arguments)
        {
            var logOptions = new LogOptions {
                LogLevel = arguments.Parameter(LogLevelParameter, LogLevel.Warning),
                CommandOutput = arguments.Parameter(CommandOutputParameter, true),
            };

            SetLogOutput(arguments, logOptions);

            return logOptions;
        }
Exemplo n.º 2
0
 private object ParseParameter(Arguments arguments, ITaskParameter p)
 {
     try {
         return arguments.Parameter(p);
     } catch(RequiredParameterNotGivenException e) {
         throw new TaskRequiredParameterException(p, this);
     } catch (TypeParserNotFoundException e) {
         throw new TaskParameterException(p, this);
     }
 }
Exemplo n.º 3
0
        private void SetLogOutput(Arguments arguments, LogOptions logOptions)
        {
            var filename = arguments.Parameter<string>(LogFileParameter, null);

            if (filename != null) {
                var textWriter = File.AppendText(filename);
                textWriter.AutoFlush = true;
                logOptions.StdErr = textWriter;
                logOptions.StdOut = textWriter;
            } else {
                logOptions.StdErr = Console.Error;
                logOptions.StdOut = Console.Out;
            }
        }