Browse Source

Write available commands on CLI help command

resolves https://github.com/abpframework/abp/issues/1186
pull/1192/head
Yunus Emre Kalkan 7 years ago
parent
commit
ba2993b236
  1. 18
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs

18
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs

@ -1,6 +1,8 @@
using System.Threading.Tasks;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Volo.Abp.Cli.Args;
using Volo.Abp.DependencyInjection;
@ -9,10 +11,12 @@ namespace Volo.Abp.Cli.Commands
public class HelpCommand : IConsoleCommand, ITransientDependency
{
public ILogger<HelpCommand> Logger { get; set; }
protected CliOptions CliOptions { get; }
public HelpCommand()
public HelpCommand(IOptions<CliOptions> cliOptions)
{
Logger = NullLogger<HelpCommand>.Instance;
CliOptions = cliOptions.Value;
}
public Task ExecuteAsync(CommandLineArgs commandLineArgs)
@ -20,10 +24,16 @@ namespace Volo.Abp.Cli.Commands
Logger.LogInformation("");
Logger.LogInformation("Usage:");
Logger.LogInformation("");
Logger.LogInformation(" abp <command> <target> [options]");
Logger.LogInformation(" abp <command> <target> [options]");
Logger.LogInformation("");
Logger.LogInformation("Command List:");
//TODO: Write available commands (not hard-coded, but from the CliOptions.Commands)
foreach (var commandKey in CliOptions.Commands.Keys.ToArray())
{
Logger.LogInformation(" " + commandKey);
}
Logger.LogInformation("");
return Task.CompletedTask;
}

Loading…
Cancel
Save