/// <inheritdoc/> protected override bool Ask(string question, MsgSeverity severity) { Log.Debug($"Question: {question}"); Console.Error.WriteLine(question); // Loop until the user has made a valid choice while (true) { switch (CliUtils.ReadString(@"[Y/N]").ToLower()) { case "y": case "yes": Log.Debug("Answer: Yes"); return(true); case "n": case "no": Log.Debug("Answer: No"); return(false); } } }
/// <inheritdoc/> public override NetworkCredential GetCredential(Uri uri, string authType) { #region Sanity checks if (uri == null) { throw new ArgumentNullException(nameof(uri)); } #endregion if (!Interactive) { return(null); } Log.Debug("Prompt for credentials on command-line: " + uri.ToStringRfc()); if (WasReportedInvalid(uri)) { Log.Error(string.Format(Resources.InvalidCredentials, uri.ToStringRfc())); } Console.Error.WriteLine(Resources.PleasEnterCredentials, uri.ToStringRfc()); return(new NetworkCredential( CliUtils.ReadString(Resources.UserName), CliUtils.ReadPassword(Resources.Password))); }