public static void Init(string workingDirectory, IFileSystem fileSystem) { var configFilePath = GetConfigFilePath(workingDirectory); var config = new ConfigInitWizard().Run(Provide(workingDirectory, fileSystem), workingDirectory, fileSystem); if (config == null) { return; } using (var stream = fileSystem.OpenWrite(configFilePath)) using (var writer = new StreamWriter(stream)) { Logger.WriteInfo("Saving config file"); ConfigSerialiser.Write(config, writer); stream.Flush(); } }
public static void Init(string workingDirectory, IFileSystem fileSystem, IConsole console) { var configFilePath = GetConfigFilePath(workingDirectory, fileSystem); var currentConfiguration = Provide(workingDirectory, fileSystem, applyDefaults: false); var config = new ConfigInitWizard(console, fileSystem).Run(currentConfiguration, workingDirectory); if (config == null) { return; } using (var stream = fileSystem.OpenWrite(configFilePath)) using (var writer = new StreamWriter(stream)) { Logger.WriteInfo("Saving config file"); ConfigSerialiser.Write(config, writer); stream.Flush(); } }