Пример #1
0
        public GitSelectCommand(ISettingAgent settingAgent, IRepositoryBusines repositoryBusiness, ITalkAgent talkAgent)
            : base(settingAgent, "Select", new string[] { })
        {
            _repositoryBusiness = repositoryBusiness;
            _talkAgent          = talkAgent;

            var repos = settingAgent.GetSettings <string>("Repositories");

            foreach (var repo in repos)
            {
                var rawPhrases = GetRawList();
                AddPhrases(repo.Key, rawPhrases.Select(x => x.Replace("{RepositoryName}", repo.Key)).ToArray());
            }

            repositoryBusiness.RepositoryAddedEvent += RepositoryBusiness_RepositoryAddedEvent;
        }
Пример #2
0
        public static async Task <string> GetSelectedPathAsync(IRepositoryBusines repositoryBusiness, ITalkAgent talkAgent, ISettingAgent settingAgent)
        {
            var gitRepoPath = repositoryBusiness.GetSelectedPath();

            if (string.IsNullOrEmpty(gitRepoPath))
            {
                var repos = settingAgent.GetSettings <string>("Repositories");
                if (!repos.Any())
                {
                    await talkAgent.SayAsync("You need to open a repository before you can ask for status.");
                }
                else
                {
                    await talkAgent.SayAsync("You need to select a repository before you can ask for status.");
                }
            }

            return(gitRepoPath);
        }