Skip to content

Commit 809ebe5

Browse files
committed
Fix visibility of Validate and Execute(Async) methods of commands
Change it back to public instead of protected. Was probably a bad merge in c2b92ac. Fixes #73
1 parent a2a92bd commit 809ebe5

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/Spectre.Console.Cli/AsyncCommand.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public abstract class AsyncCommand : ICommand<EmptyCommandSettings>
1111
/// <param name="context">The command context.</param>
1212
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to abort the command.</param>
1313
/// <returns>An integer indicating whether the command executed successfully.</returns>
14-
protected abstract Task<int> ExecuteAsync(CommandContext context, CancellationToken cancellationToken);
14+
public abstract Task<int> ExecuteAsync(CommandContext context, CancellationToken cancellationToken);
1515

1616
/// <inheritdoc/>
1717
Task<int> ICommand<EmptyCommandSettings>.ExecuteAsync(CommandContext context, EmptyCommandSettings settings, CancellationToken cancellationToken)

‎src/Spectre.Console.Cli/AsyncCommandOfT.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public abstract class AsyncCommand<TSettings> : ICommand<TSettings>
1313
/// <param name="context">The command context.</param>
1414
/// <param name="settings">The settings.</param>
1515
/// <returns>The validation result.</returns>
16-
protected virtual ValidationResult Validate(CommandContext context, TSettings settings)
16+
public virtual ValidationResult Validate(CommandContext context, TSettings settings)
1717
{
1818
return ValidationResult.Success();
1919
}
@@ -25,7 +25,7 @@ protected virtual ValidationResult Validate(CommandContext context, TSettings se
2525
/// <param name="settings">The settings.</param>
2626
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to abort the command.</param>
2727
/// <returns>An integer indicating whether or not the command executed successfully.</returns>
28-
protected abstract Task<int> ExecuteAsync(CommandContext context, TSettings settings, CancellationToken cancellationToken);
28+
public abstract Task<int> ExecuteAsync(CommandContext context, TSettings settings, CancellationToken cancellationToken);
2929

3030
/// <inheritdoc/>
3131
ValidationResult ICommand.Validate(CommandContext context, CommandSettings settings)

‎src/Spectre.Console.Cli/Command.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public abstract class Command : ICommand<EmptyCommandSettings>
1212
/// <param name="context">The command context.</param>
1313
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to abort the command.</param>
1414
/// <returns>An integer indicating whether the command executed successfully.</returns>
15-
protected abstract int Execute(CommandContext context, CancellationToken cancellationToken);
15+
public abstract int Execute(CommandContext context, CancellationToken cancellationToken);
1616

1717
/// <inheritdoc/>
1818
Task<int> ICommand<EmptyCommandSettings>.ExecuteAsync(CommandContext context, EmptyCommandSettings settings, CancellationToken cancellationToken)

‎src/Spectre.Console.Cli/CommandOfT.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public abstract class Command<TSettings> : ICommand<TSettings>
1414
/// <param name="context">The command context.</param>
1515
/// <param name="settings">The settings.</param>
1616
/// <returns>The validation result.</returns>
17-
protected virtual ValidationResult Validate(CommandContext context, TSettings settings)
17+
public virtual ValidationResult Validate(CommandContext context, TSettings settings)
1818
{
1919
return ValidationResult.Success();
2020
}
@@ -26,7 +26,7 @@ protected virtual ValidationResult Validate(CommandContext context, TSettings se
2626
/// <param name="settings">The settings.</param>
2727
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to abort the command.</param>
2828
/// <returns>An integer indicating whether the command executed successfully.</returns>
29-
protected abstract int Execute(CommandContext context, TSettings settings, CancellationToken cancellationToken);
29+
public abstract int Execute(CommandContext context, TSettings settings, CancellationToken cancellationToken);
3030

3131
/// <inheritdoc/>
3232
ValidationResult ICommand.Validate(CommandContext context, CommandSettings settings)

0 commit comments

Comments
 (0)