Пример #1
0
 public static OptionsConfig Create(RosaliaOptions options)
 {
     return new OptionsConfig
     {
         {
             new Option("nl|nologo", "Do not show Rosalia logo"),
             (v, s) => options.NoLogo = true
         },
         {
             new Option("h|help|?", "Show this help message"),
             (v, s) => options.ShowHelp = true
         },
         {
             new Option("p|prop|property", "Set property"),
             (v, s) => options.Properties.Add(s, v)
         },
         {
             new Option("w|workflow", "Set workflow type (if multiples in assembly)"),
             (v, s) => options.Workflow = v
         },
         {
             new Option("t|task", "Set task to run"),
             (v, s) => options.Tasks += new Identity(v)
         },
         {
             new Option("hl|hold", "Do not close console"),
             (v, s) => options.Hold = true
         },
         {
             new Option("wd|workDirectory", "Work directory"),
             (v, s) => options.WorkDirectory = v
         },
         {
             new Option("ll|logLevel", "Log Level"),
             (v, s) => options.LogLevel = (MessageLevel?) Enum.Parse(typeof(MessageLevel), v)
         },
         {
             new Option("workflowBuildOutput", "Workflow project build output path"),
             (v, s) => options.WorkflowBuildOutputPath = v
         },
         {
             new Option("workflowBuildConfiguration", "Workflow build configuration"),
             (v, s) => options.WorkflowProjectBuildConfiguration = v
         },
         {
             new Option("o|out|output", "Path to a file to write log to"),
             (v, s) => options.OutputFiles.Add(v)
         }
     };
 }
Пример #2
0
        private static IFile GetInputFile(RosaliaOptions options, IDirectory workDirectory)
        {
            var inputFile = options.InputFile;
            if (string.IsNullOrEmpty(inputFile))
            {
                return null;
            }

            IFile result = Path.IsPathRooted(inputFile)
                ? new DefaultFile(inputFile)
                : workDirectory[options.InputFile].AsFile();

            return result;
        }
Пример #3
0
        private static InitializationResult InitializeWorkflow(
            RosaliaOptions options,
            IDirectory workDirectory,
            ILogRenderer logRenderer,
            IFile inputFile)
        {
            var runner = new Runner();

            var runningOptions = new RunningOptions
            {
                InputFile = inputFile,
                WorkflowBuildOutputPath = options.WorkflowBuildOutputPath,
                WorkflowProjectBuildConfiguration = options.WorkflowProjectBuildConfiguration,
                LogRenderer = logRenderer,
                WorkDirectory = workDirectory,
                Properties = options.Properties
            };

            return runner.Init(runningOptions);
        }