Ejemplo n.º 1
0
 public static Task <ExitCode> CreateDefaultSettingsFile(CreateSettingsOptions opts, TextWriter stdErr)
 {
     if (File.Exists(opts.OutputFilename))
     {
         stdErr.WriteLine("Output file '' already exists. Aborting.");
         return(Task.FromResult(ExitCode.ExportFileExists(opts.OutputFilename)));
     }
     SettingsFileHelpers.ToFile(opts.OutputFilename, Settings.Default);
     return(Task.FromResult(ExitCode.Success));
 }
Ejemplo n.º 2
0
        static Settings GetSettings(ExcelReportOptions opts, TextWriter stdErr)
        {
            if (opts.PathToSettingsFile == null)
            {
                stdErr.WriteLine($"Settings file not specified. Using default settings.");
                return(Settings.Default);
            }

            if (!File.Exists(opts.PathToSettingsFile))
            {
                stdErr.WriteLine($"Could not find specified settings file: {opts.PathToSettingsFile}. Using default settings.");
                return(Settings.Default);
            }

            return(SettingsFileHelpers.FromFile(opts.PathToSettingsFile));
        }