Beispiel #1
0
        private static CommandResponse HandleUntrack(GitHubUser user, Command command)
        {
            try
            {
                string text = command.text, action = text.Split(' ')[0];
                string repository = text.Split(' ').Length >= 2 ? command.text.Substring(text.IndexOf(action) + (action.Length + 1)) : "";

                if (user.UntrackRepository(repository))
                {
                    if (repository == "*")
                    {
                        repository = "*all repositories*";
                    }
                    return(new CommandResponse("*Successfully untracked* " + repository));
                }
                else
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine("*Here are your available tracked repositories:* ");
                    sb.AppendLine(FormatRepositoryList(user.TrackedRepositories));
                    return(new CommandResponse(sb.ToString()));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return(new CommandResponse(":cry: There was an error processing your request. Please try again."));
            }
        }
Beispiel #2
0
        private static CommandResponse HandleUntrack(GitHubUser user, Command command)
        {
            string text = command.text, action = text.Split(' ')[0];
            string repository = text.Split(' ').Length >= 2 ? command.text.Substring(text.IndexOf(action) + (action.Length + 1)) : "";

            if (user.UntrackRepository(repository))
            {
                return(new CommandResponse("*Successfully untracked* " + repository));
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("*Here are your available tracked repositories:* ");
                sb.AppendLine(FormatRepositoryList(user.TrackedRepositories));
                return(new CommandResponse(sb.ToString()));
            }
        }