forked from scriptcs/scriptcs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShowUsageCommand.cs
More file actions
33 lines (27 loc) · 814 Bytes
/
ShowUsageCommand.cs
File metadata and controls
33 lines (27 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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<ScriptCsArgs>(options: options);
if (_isValid)
{
_logger.Info(usage);
return CommandResult.Success;
}
_logger.Error(usage);
return CommandResult.Error;
}
}
}