Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions src/Mindee.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
using SettingsV1 = Mindee.V1.Http.Settings;
using V1Client = Mindee.V1.Client;

var verbose = args.Contains("--verbose");

var host = Host.CreateDefaultBuilder(args)
.ConfigureHostConfiguration(configuration =>
{
Expand All @@ -93,11 +95,24 @@
["hostBuilder:reloadConfigOnChange"] = "false"
});
})
.ConfigureAppConfiguration((_, config) =>
{
if (verbose)
{
config.AddInMemoryCollection(new Dictionary<string, string?>
{
["Logging:LogLevel:Default"] = "Information"
});
}
})
.ConfigureLogging((_, logging) =>
{
logging.ClearProviders();
logging.AddConsole();
logging.AddDebug();
if (verbose)
{
logging.AddConsole();
logging.AddDebug();
}
})
.ConfigureServices((_, services) =>
{
Expand Down Expand Up @@ -298,11 +313,12 @@ static RootCommand BuildCommandLine(IServiceProvider services, string[] args)
BuildV1Commands(v1Command, services, args);
root.Add(v1Command);

var silentOption = new Option<bool>("--silent")
var verboseOption = new Option<bool>("--verbose")
{
Description = "Disables diagnostics output"
Description = "Enables diagnostics output",
Recursive = true
};
root.Options.Add(silentOption);
root.Options.Add(verboseOption);

root.SetAction(_ =>
{
Expand Down
Loading