Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/Stack/Commands/Stack/ListStacksCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override void WriteDefaultOutput(ListStacksCommandResponse response)

foreach (var stack in response.Stacks)
{
StdErr.MarkupLine($"{stack.Name.Stack()} {$"({stack.SourceBranch})".Muted()} {"branch".ToQuantity(stack.BranchCount)}");
StdOutLogger.Information($"{stack.Name.Stack()} {$"({stack.SourceBranch})".Muted()} {"branch".ToQuantity(stack.BranchCount)}");
}
}
}
Expand Down
15 changes: 8 additions & 7 deletions src/Stack/Infrastructure/Commands/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,32 @@ namespace Stack.Commands;

public abstract class Command<T> : AsyncCommand<T> where T : CommandSettingsBase
{
protected IAnsiConsole StdOut;
protected IAnsiConsole StdErr;
protected ILogger StdOutLogger;
protected ILogger StdErrLogger;
protected IInputProvider InputProvider;

public Command()
{
StdOut = AnsiConsole.Create(new AnsiConsoleSettings
var stdOutAnsiConsole = AnsiConsole.Create(new AnsiConsoleSettings
{
Ansi = AnsiSupport.Detect,
ColorSystem = ColorSystemSupport.Detect,
Out = new AnsiConsoleOutput(Console.Out),
});
StdErr = AnsiConsole.Create(new AnsiConsoleSettings
var stdErrAnsiConsole = AnsiConsole.Create(new AnsiConsoleSettings
{
Ansi = AnsiSupport.Detect,
ColorSystem = ColorSystemSupport.Detect,
Out = new AnsiConsoleOutput(Console.Error),
});
StdOutLogger = new ConsoleLogger(StdOut);
StdErrLogger = new ConsoleLogger(StdErr);
InputProvider = new ConsoleInputProvider(StdErr);
StdOutLogger = new ConsoleLogger(stdOutAnsiConsole);
StdErrLogger = new ConsoleLogger(stdErrAnsiConsole);
InputProvider = new ConsoleInputProvider(stdErrAnsiConsole);
}

protected TextWriter StdOut => Console.Out;
protected TextWriter StdErr => Console.Error;

public override async Task<int> ExecuteAsync(CommandContext context, T settings)
{
await Execute(settings);
Expand Down