mirror of https://github.com/abpframework/abp.git
7 changed files with 63 additions and 32 deletions
@ -1,20 +1,22 @@ |
|||
using Volo.Abp.DependencyInjection; |
|||
using System; |
|||
using Volo.Abp.Cli.Args; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.Cli |
|||
namespace Volo.Abp.Cli.Commands |
|||
{ |
|||
public class CommandSelector : ICommandSelector, ITransientDependency |
|||
{ |
|||
public IConsoleCommand Select(CommandLineArgs commandLineArgs) |
|||
public Type Select(CommandLineArgs commandLineArgs) |
|||
{ |
|||
//TODO: Create options to define commands
|
|||
//TODO: Get from dependency injection instead of new?
|
|||
|
|||
if (commandLineArgs.Command == "new") |
|||
{ |
|||
return new NewProjectCommand(commandLineArgs); |
|||
return typeof(NewProjectCommand); |
|||
} |
|||
|
|||
return new MainHelpCommand(commandLineArgs); |
|||
return typeof(MainHelpCommand); |
|||
} |
|||
} |
|||
} |
|||
@ -1,7 +1,10 @@ |
|||
namespace Volo.Abp.Cli |
|||
using System; |
|||
using Volo.Abp.Cli.Args; |
|||
|
|||
namespace Volo.Abp.Cli.Commands |
|||
{ |
|||
public interface ICommandSelector |
|||
{ |
|||
IConsoleCommand Select(CommandLineArgs commandLineArgs); |
|||
Type Select(CommandLineArgs commandLineArgs); |
|||
} |
|||
} |
|||
@ -1,9 +1,10 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Cli.Args; |
|||
|
|||
namespace Volo.Abp.Cli |
|||
namespace Volo.Abp.Cli.Commands |
|||
{ |
|||
public interface IConsoleCommand |
|||
{ |
|||
Task ExecuteAsync(); |
|||
Task ExecuteAsync(CommandLineArgs commandLineArgs); |
|||
} |
|||
} |
|||
@ -1,21 +1,41 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Cli.Args; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.SolutionTemplating; |
|||
using Volo.Abp.SolutionTemplating.Building; |
|||
|
|||
namespace Volo.Abp.Cli |
|||
namespace Volo.Abp.Cli.Commands |
|||
{ |
|||
public class NewProjectCommand : IConsoleCommand |
|||
public class NewProjectCommand : IConsoleCommand, ITransientDependency |
|||
{ |
|||
protected CommandLineArgs CommandLineArgs { get; } |
|||
protected SolutionBuilder SolutionBuilder { get; } |
|||
|
|||
public NewProjectCommand(CommandLineArgs commandLineArgs) |
|||
public NewProjectCommand(SolutionBuilder solutionBuilder) |
|||
{ |
|||
CommandLineArgs = commandLineArgs; |
|||
SolutionBuilder = solutionBuilder; |
|||
} |
|||
|
|||
public Task ExecuteAsync() |
|||
public async Task ExecuteAsync(CommandLineArgs commandLineArgs) |
|||
{ |
|||
if (commandLineArgs.Target == null) |
|||
{ |
|||
Console.WriteLine("Project name is missing."); |
|||
Console.WriteLine("Usage:"); |
|||
Console.WriteLine(" abp new <project-name>"); |
|||
Console.WriteLine("Example:"); |
|||
Console.WriteLine(" abp new Acme.BookStore"); |
|||
} |
|||
|
|||
Console.WriteLine("TODO: Create new project"); |
|||
return Task.CompletedTask; |
|||
|
|||
//await SolutionBuilder.BuildAsync(
|
|||
// null,
|
|||
// commandLineArgs.Target,
|
|||
// DatabaseProvider.EntityFrameworkCore,
|
|||
// "...",
|
|||
// true
|
|||
//);
|
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue