/// <summary> /// Prompts the user to input a file path with a suggested default path. /// </summary> /// <param name="defaultPath">The default file path the user must accept.</param> /// <param name="message"><inheritdoc cref="Write" path="/param[@name='message']"/></param> /// <param name="checkExists"><inheritdoc cref="PromptForFilepath(string, bool, ConsoleColor?)" path="/param[@name='checkExists']"/></param> /// <param name="color"><inheritdoc cref="Write" path="/param[@name='color']"/></param> /// <returns></returns> public static string PromptForFilepath(string defaultPath, string message, bool checkExists, ConsoleColor?color = null) { string path = defaultPath; if (!File.Exists(path) || !Consoul.Ask($"Would you like to use the default path:\r\n{path}", defaultIsNo: false)) { path = PromptForFilepath(message, checkExists, color); } return(path); }
public bool Test(T source) { bool response = _rememberChoice; if (_ask && Consoul.Ask(PromptMessage.Compile()(source))) { response = true; } if (!_asked) { if (Consoul.Ask(RememberMessage.Compile()(response))) { _rememberChoice = response; _ask = false; } _asked = true; } return(response); }