using Common.Logging; using PowerArgs; namespace ScriptCs.Command { internal class ShowUsageCommand : IHelpCommand, IInvalidCommand { private readonly ILog _logger; private readonly bool _isValid; public ShowUsageCommand(ILog logger, bool isValid) { _logger = logger; _isValid = isValid; } public CommandResult Execute() { var options = new ArgUsageOptions { ShowPosition = false, ShowType = false }; var usage = ArgUsage.GetUsage(options: options); if (_isValid) { _logger.Info(usage); return CommandResult.Success; } _logger.Error(usage); return CommandResult.Error; } } }