1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

quiet output for setup scripts

This commit is contained in:
Kyle Spearrin
2019-03-12 10:26:14 -04:00
parent 14fd7e2801
commit b6f54324a5
8 changed files with 70 additions and 22 deletions

View File

@ -165,8 +165,12 @@ namespace Bit.Setup
return input == "y" || input == "yes";
}
public static void ShowBanner(string title, string message, ConsoleColor? color = null)
public static void ShowBanner(Context context, string title, string message, ConsoleColor? color = null)
{
if(!context.PrintToScreen())
{
return;
}
if(color != null)
{
Console.ForegroundColor = color.Value;
@ -192,5 +196,34 @@ namespace Bit.Setup
return HandlebarsDotNet.Handlebars.Compile(templateText);
}
}
public static void WriteLine(Context context, string format = null, object arg0 = null, object arg1 = null,
object arg2 = null)
{
if(!context.PrintToScreen())
{
return;
}
if(format != null && arg0 != null && arg1 != null && arg2 != null)
{
Console.WriteLine(format, arg0, arg1, arg2);
}
else if(format != null && arg0 != null && arg1 != null)
{
Console.WriteLine(format, arg0, arg1);
}
else if(format != null && arg0 != null)
{
Console.WriteLine(format, arg0);
}
else if(format != null)
{
Console.WriteLine(format);
}
else
{
Console.WriteLine();
}
}
}
}