remove --self for now

This commit is contained in:
vilmibm 2020-02-11 20:46:46 -06:00
parent c93c5f7668
commit 135c63aa36
3 changed files with 7 additions and 31 deletions

View file

@ -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{

View file

@ -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{

View file

@ -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
}