From 135c63aa363a873719e6f132f2692a0cd07cc48a Mon Sep 17 00:00:00 2001 From: vilmibm Date: Tue, 11 Feb 2020 20:46:46 -0600 Subject: [PATCH] remove --self for now --- command/issue.go | 5 ----- command/pr.go | 4 ---- command/root.go | 29 +++++++---------------------- 3 files changed, 7 insertions(+), 31 deletions(-) diff --git a/command/issue.go b/command/issue.go index 721dc0f98..0d11f5ad4 100644 --- a/command/issue.go +++ b/command/issue.go @@ -30,19 +30,14 @@ func init() { issueCreateCmd.Flags().StringP("body", "b", "", "Supply a body. Will prompt for one otherwise.") issueCreateCmd.Flags().BoolP("web", "w", false, "Open the browser to create an issue") - issueCreateCmd.Flags().BoolP("self", "S", false, "Query current repository instead of forked parent") issueCmd.AddCommand(issueListCmd) issueListCmd.Flags().StringP("assignee", "a", "", "Filter by assignee") issueListCmd.Flags().StringSliceP("label", "l", nil, "Filter by label") issueListCmd.Flags().StringP("state", "s", "", "Filter by state: {open|closed|all}") issueListCmd.Flags().IntP("limit", "L", 30, "Maximum number of issues to fetch") - issueListCmd.Flags().BoolP("self", "S", false, "Query current repository instead of forked parent") issueViewCmd.Flags().BoolP("preview", "p", false, "Display preview of issue content") - issueViewCmd.Flags().BoolP("self", "S", false, "Query current repository instead of forked parent") - - issueStatusCmd.Flags().BoolP("self", "S", false, "Query current repository instead of forked parent") } var issueCmd = &cobra.Command{ diff --git a/command/pr.go b/command/pr.go index 4bd3059eb..039b8c37a 100644 --- a/command/pr.go +++ b/command/pr.go @@ -29,12 +29,8 @@ func init() { prListCmd.Flags().StringP("base", "B", "", "Filter by base branch") prListCmd.Flags().StringSliceP("label", "l", nil, "Filter by label") prListCmd.Flags().StringP("assignee", "a", "", "Filter by assignee") - prListCmd.Flags().BoolP("self", "S", false, "Query current repository instead of forked parent") prViewCmd.Flags().BoolP("preview", "p", false, "Display preview of pull request content") - prViewCmd.Flags().BoolP("self", "S", false, "Query current repository instead of forked parent") - - prStatusCmd.Flags().BoolP("self", "S", false, "Query current repository instead of forked parent") } var prCmd = &cobra.Command{ diff --git a/command/root.go b/command/root.go index d3078dee2..7b9b62ce1 100644 --- a/command/root.go +++ b/command/root.go @@ -164,35 +164,20 @@ func determineBaseRepo(cmd *cobra.Command, ctx context.Context) (*ghrepo.Interfa return nil, err } - baseRepo, err := ctx.BaseRepo() + remotes, err := ctx.Remotes() if err != nil { return nil, err } - preferSelf, err := cmd.Flags().GetBool("self") + repoContext, err := context.ResolveRemotesToRepos(remotes, apiClient, baseOverride) + if err != nil { + return nil, err + } + var baseRepo ghrepo.Interface + baseRepo, err = repoContext.BaseRepo() if err != nil { return nil, err } - if preferSelf == false { - remotes, err := ctx.Remotes() - if err != nil { - return nil, err - } - - // TODO given remotes: - // [upstream] cli/cli - // [origin] vilmibm/cli - // we're picking the wrong thing. i think preferSelf needs to be threaded through to - // ResolveRemotesToRepos in the same way as baseOverride. - repoContext, err := context.ResolveRemotesToRepos(remotes, apiClient, baseOverride) - if err != nil { - return nil, err - } - baseRepo, err = repoContext.BaseRepo() - } - if err != nil { - return nil, err - } return &baseRepo, nil }