Skip to content

Commit 80a02fc

Browse files
authored
Merge pull request GitTools#576 from AdmiringWorm/AdmiringWorm/issue439
(GitTools#439) Add option to disable warning to stderr
2 parents a94d9d5 + 6d0b8c3 commit 80a02fc

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/GitReleaseManager.Cli/Logging/LogConfiguration.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private static void CreateConsoleFullLogger(LoggerConfiguration config, string c
4343
.Filter.ByExcluding((logEvent) => !options.Verbose && logEvent.Level == LogEventLevel.Verbose)
4444
.WriteTo.Console(
4545
outputTemplate: consoleTemplate,
46-
standardErrorFromLevel: LogEventLevel.Warning,
46+
standardErrorFromLevel: options.IsCISystem ? LogEventLevel.Error : LogEventLevel.Warning,
4747
theme: consoleTheme));
4848
}
4949

src/GitReleaseManager.Core/Options/BaseSubOptions.cs

+15
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1+
using System;
12
using CommandLine;
23

34
namespace GitReleaseManager.Core.Options
45
{
56
public abstract class BaseSubOptions
67
{
8+
protected BaseSubOptions()
9+
{
10+
var ciEnvironmentVariable = Environment.GetEnvironmentVariable("CI");
11+
12+
bool isCiSystem;
13+
if (!string.IsNullOrEmpty(ciEnvironmentVariable) && bool.TryParse(ciEnvironmentVariable, out isCiSystem))
14+
{
15+
IsCISystem = isCiSystem;
16+
}
17+
}
18+
719
[Option("debug", HelpText = "Enable debugging console output")]
820
public bool Debug { get; set; }
921

@@ -18,5 +30,8 @@ public abstract class BaseSubOptions
1830

1931
[Option("verbose", HelpText = "Enable verbose console output")]
2032
public bool Verbose { get; set; }
33+
34+
[Option("ci", HelpText = "Configure GitReleaseManager to be compatible with CI systems")]
35+
public bool IsCISystem { get; set; }
2136
}
2237
}

0 commit comments

Comments
 (0)