public async Task ExecuteAsync(CommandLineArgs commandLineArgs) { if (commandLineArgs.Target == null) { throw new CliUsageException( "Module name is missing!" + Environment.NewLine + Environment.NewLine + GetUsageInfo() ); } var withSourceCode = commandLineArgs.Options.ContainsKey("with-source-code"); var skipDbMigrations = Convert.ToBoolean( commandLineArgs.Options.GetOrNull(Options.DbMigrations.Skip) ?? "false"); var solutionFile = GetSolutionFile(commandLineArgs); var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long); if (version == null) { version = SolutionAbpVersionFinder.Find(solutionFile); } await SolutionModuleAdder.AddAsync( solutionFile, commandLineArgs.Target, commandLineArgs.Options.GetOrNull(Options.StartupProject.Short, Options.StartupProject.Long), version, skipDbMigrations, withSourceCode ); }
public async Task ExecuteAsync(CommandLineArgs commandLineArgs) { if (commandLineArgs.Target == null) { throw new CliUsageException( "Module name is missing!" + Environment.NewLine + Environment.NewLine + GetUsageInfo() ); } var newTemplate = commandLineArgs.Options.ContainsKey(Options.NewTemplate.Long); var template = commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long); var newProTemplate = !string.IsNullOrEmpty(template) && template == ModuleProTemplate.TemplateName; var withSourceCode = newTemplate || newProTemplate || commandLineArgs.Options.ContainsKey(Options.SourceCode.Long); var addSourceCodeToSolutionFile = withSourceCode && commandLineArgs.Options.ContainsKey("add-to-solution-file"); var skipDbMigrations = newTemplate || newProTemplate || commandLineArgs.Options.ContainsKey(Options.DbMigrations.Skip); var solutionFile = GetSolutionFile(commandLineArgs); var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long); if (version == null) { version = SolutionPackageVersionFinder.Find(solutionFile); } var moduleInfo = await SolutionModuleAdder.AddAsync( solutionFile, commandLineArgs.Target, version, skipDbMigrations, withSourceCode, addSourceCodeToSolutionFile, newTemplate, newProTemplate ); _lastAddedModuleInfo = new AddModuleInfoOutput { DisplayName = moduleInfo.DisplayName, Name = moduleInfo.Name, DocumentationLinks = moduleInfo.DocumentationLinks, InstallationCompleteMessage = moduleInfo.InstallationCompleteMessage }; }
public async Task ExecuteAsync(CommandLineArgs commandLineArgs) { if (commandLineArgs.Target == null) { throw new CliUsageException( "Module name is missing!" + Environment.NewLine + Environment.NewLine + GetUsageInfo() ); } var newTemplate = commandLineArgs.Options.ContainsKey(Options.NewTemplate.Long); var template = commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long); var newProTemplate = !string.IsNullOrEmpty(template) && template == ModuleProTemplate.TemplateName; var withSourceCode = newTemplate || newProTemplate || commandLineArgs.Options.ContainsKey(Options.SourceCode.Long); var addSourceCodeToSolutionFile = withSourceCode && commandLineArgs.Options.ContainsKey("add-to-solution-file"); var skipDbMigrations = newTemplate || newProTemplate || Convert.ToBoolean( commandLineArgs.Options.GetOrNull(Options.DbMigrations.Skip) ?? "false"); var solutionFile = GetSolutionFile(commandLineArgs); var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long); if (version == null) { version = SolutionAbpVersionFinder.Find(solutionFile); } await SolutionModuleAdder.AddAsync( solutionFile, commandLineArgs.Target, commandLineArgs.Options.GetOrNull(Options.StartupProject.Short, Options.StartupProject.Long), version, skipDbMigrations, withSourceCode, addSourceCodeToSolutionFile, newTemplate, newProTemplate ); }