Skip to content

Commit

Permalink
fix global args
Browse files Browse the repository at this point in the history
  • Loading branch information
byCrookie committed Oct 27, 2023
1 parent 9eb2cac commit c292ad8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public async Task InvokeAsync_ShortFlagsArePassed_FlagsGetParsed()
globalArgs =>
{
globalArgs.Should().NotBeNull();
globalArgs.LogFile!.Name.Should().Be("log.txt");
globalArgs.LogFile.Should().BeNull();
globalArgs.Quiet.Should().BeTrue();
globalArgs.Verbosity.Should().Be(LogLevel.Debug);
globalArgs.Verbosity.Should().Be(LogLevel.Information);
},
new GlobalArgsBinder(_globalArguments)
);
Expand All @@ -68,7 +68,7 @@ public async Task InvokeAsync_NoFlagsArePassed_DefaultsAreUsed()
{
globalArgs.Should().NotBeNull();
globalArgs.LogFile.Should().BeNull();
globalArgs.Quiet.Should().BeFalse();
globalArgs.Quiet.Should().BeTrue();
globalArgs.Verbosity.Should().Be(LogLevel.Information);
},
new GlobalArgsBinder(_globalArguments)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ internal static class GlobalArgDescriptions
{
public static readonly Description Quiet = new("Quiet", "Quiet", "Do not print logs to console.");
public static readonly Description LogFile = new("LogFile", "Log file", "Path to the log file.");
public static readonly Description Verbosity = new("Verbosity", "Verbosity", "Set the verbosity level.");
public static readonly Description Verbosity = new("Verbosity", "Verbosity", "Set the verbosity level of the log file.");
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ namespace GithubBackup.Cli.Commands.Global;
public class GlobalArguments
{
public Option<bool> QuietOption { get; } = new(
aliases: new[] { "-q", "--quiet" },
getDefaultValue: () => false,
aliases: new[] { "--quiet" },
getDefaultValue: () => true,
description: GlobalArgDescriptions.Quiet.Long
);

public Option<FileInfo?> LogFileOption { get; } = new(
aliases: new[] { "-l", "--log-file" },
aliases: new[] { "--log-file" },
description: GlobalArgDescriptions.LogFile.Long
);

public Option<LogLevel> VerbosityOption { get; } = new(
aliases: new[] { "-v", "--verbosity" },
aliases: new[] { "--verbosity" },
getDefaultValue: () => LogLevel.Information,
description: GlobalArgDescriptions.Verbosity.Long
);
Expand Down

0 comments on commit c292ad8

Please sign in to comment.