static int Main(string[] args) { var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: false) .AddEnvironmentVariables("ChangeLog:") .AddCommandLine(args) .Build(); var githubSettings = new GithubSettings(); configuration.Bind(githubSettings); var gitSettings = new GitSettings(); configuration.Bind(gitSettings); var cosmosDbSettings = new CosmosDbSettings(); configuration.Bind(cosmosDbSettings); var gitHubService = new GithubService(githubSettings); var gitService = new GitService(gitSettings); var cosmoDbRepository = new CosmosDbRepository(cosmosDbSettings); var directAccessRepository = new DirectAccessChangeLogRepository(gitHubService, gitService); var app = new CommandLineApplication(); app.HelpOption(inherited: true); var showCommand = new ShowCommand(cosmoDbRepository, directAccessRepository); var loadCommand = new LoadCommand(cosmoDbRepository, directAccessRepository); app.Command("show", showCommand.Configure); app.Command("load", loadCommand.Configure); app.OnExecute(() => { Console.WriteLine("Specify a subcommand"); app.ShowHelp(); return(1); }); return(app.Execute(args)); }
public LoadCommand(CosmosDbRepository cosmoDbRepository, DirectAccessChangeLogRepository directAccessRepository) { _cosmosDbRepository = cosmoDbRepository; _directAccessRepository = directAccessRepository; }