Undo unnecessary renames

This commit is contained in:
AliabbasMerchant 2020-05-26 07:10:28 +05:30
parent 5fc722fbb8
commit 42edd42da1
2 changed files with 24 additions and 24 deletions

View file

@ -29,14 +29,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().StringSliceP("assignees", "a", nil, "Assign people by their `login`")
issueCreateCmd.Flags().StringSliceP("labels", "l", nil, "Add labels by `name`")
issueCreateCmd.Flags().StringSliceP("projects", "p", nil, "Add the issue to projects by `name`")
issueCreateCmd.Flags().StringSliceP("assignee", "a", nil, "Assign a person by their `login`")
issueCreateCmd.Flags().StringSliceP("label", "l", nil, "Add a label by `name`")
issueCreateCmd.Flags().StringSliceP("project", "p", nil, "Add the issue to a project by `name`")
issueCreateCmd.Flags().StringP("milestone", "m", "", "Add the issue to a milestone by `name`")
issueCmd.AddCommand(issueListCmd)
issueListCmd.Flags().StringP("assignee", "a", "", "Filter by assignee")
issueListCmd.Flags().StringSliceP("labels", "l", nil, "Filter by labels")
issueListCmd.Flags().StringSliceP("label", "l", nil, "Filter by label")
issueListCmd.Flags().StringP("state", "s", "open", "Filter by state: {open|closed|all}")
issueListCmd.Flags().IntP("limit", "L", 30, "Maximum number of issues to fetch")
issueListCmd.Flags().StringP("author", "A", "", "Filter by author")
@ -116,7 +116,7 @@ func issueList(cmd *cobra.Command, args []string) error {
return err
}
labels, err := cmd.Flags().GetStringSlice("labels")
labels, err := cmd.Flags().GetStringSlice("label")
if err != nil {
return err
}
@ -373,15 +373,15 @@ func issueCreate(cmd *cobra.Command, args []string) error {
return fmt.Errorf("could not parse body: %w", err)
}
assignees, err := cmd.Flags().GetStringSlice("assignees")
assignees, err := cmd.Flags().GetStringSlice("assignee")
if err != nil {
return fmt.Errorf("could not parse assignees: %w", err)
}
labelNames, err := cmd.Flags().GetStringSlice("labels")
labelNames, err := cmd.Flags().GetStringSlice("label")
if err != nil {
return fmt.Errorf("could not parse labels: %w", err)
}
projectNames, err := cmd.Flags().GetStringSlice("projects")
projectNames, err := cmd.Flags().GetStringSlice("project")
if err != nil {
return fmt.Errorf("could not parse projects: %w", err)
}

View file

@ -124,19 +124,19 @@ func prCreate(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("could not parse body: %w", err)
}
reviewers, err := cmd.Flags().GetStringSlice("reviewers")
reviewers, err := cmd.Flags().GetStringSlice("reviewer")
if err != nil {
return fmt.Errorf("could not parse reviewers: %w", err)
}
assignees, err := cmd.Flags().GetStringSlice("assignees")
assignees, err := cmd.Flags().GetStringSlice("assignee")
if err != nil {
return fmt.Errorf("could not parse assignees: %w", err)
}
labelNames, err := cmd.Flags().GetStringSlice("labels")
labelNames, err := cmd.Flags().GetStringSlice("label")
if err != nil {
return fmt.Errorf("could not parse labels: %w", err)
}
projectNames, err := cmd.Flags().GetStringSlice("projects")
projectNames, err := cmd.Flags().GetStringSlice("project")
if err != nil {
return fmt.Errorf("could not parse projects: %w", err)
}
@ -178,17 +178,17 @@ func prCreate(cmd *cobra.Command, _ []string) error {
}
if !isWeb {
headBranchRef := headBranch
headBranchLabel := headBranch
if headRepo != nil && !ghrepo.IsSame(baseRepo, headRepo) {
headBranchRef = fmt.Sprintf("%s:%s", headRepo.RepoOwner(), headBranch)
headBranchLabel = fmt.Sprintf("%s:%s", headRepo.RepoOwner(), headBranch)
}
existingPR, err := api.PullRequestForBranch(client, baseRepo, baseBranch, headBranchRef)
existingPR, err := api.PullRequestForBranch(client, baseRepo, baseBranch, headBranchLabel)
var notFound *api.NotFoundError
if err != nil && !errors.As(err, &notFound) {
return fmt.Errorf("error checking for existing pull request: %w", err)
}
if err == nil {
return fmt.Errorf("a pull request for branch %q into branch %q already exists:\n%s", headBranchRef, baseBranch, existingPR.URL)
return fmt.Errorf("a pull request for branch %q into branch %q already exists:\n%s", headBranchLabel, baseBranch, existingPR.URL)
}
}
@ -268,9 +268,9 @@ func prCreate(cmd *cobra.Command, _ []string) error {
didForkRepo = true
}
headBranchRef := headBranch
headBranchLabel := headBranch
if !ghrepo.IsSame(baseRepo, headRepo) {
headBranchRef = fmt.Sprintf("%s:%s", headRepo.RepoOwner(), headBranch)
headBranchLabel = fmt.Sprintf("%s:%s", headRepo.RepoOwner(), headBranch)
}
if headRemote == nil {
@ -325,7 +325,7 @@ func prCreate(cmd *cobra.Command, _ []string) error {
"body": body,
"draft": isDraft,
"baseRefName": baseBranch,
"headRefName": headBranchRef,
"headRefName": headBranchLabel,
}
err = addMetadataToIssueParams(client, baseRepo, params, &tb)
@ -344,7 +344,7 @@ func prCreate(cmd *cobra.Command, _ []string) error {
if len(milestoneTitles) > 0 {
milestone = milestoneTitles[0]
}
openURL := generateCompareURL(baseRepo, baseBranch, headBranchRef, title, body, assignees, labelNames, projectNames, milestone)
openURL := generateCompareURL(baseRepo, baseBranch, headBranchLabel, title, body, assignees, labelNames, projectNames, milestone)
// TODO could exceed max url length for explorer
fmt.Fprintf(cmd.ErrOrStderr(), "Opening %s in your browser.\n", displayURL(openURL))
return utils.OpenInBrowser(openURL)
@ -451,9 +451,9 @@ func init() {
prCreateCmd.Flags().BoolP("web", "w", false, "Open the web browser to create a pull request")
prCreateCmd.Flags().BoolP("fill", "f", false, "Do not prompt for title/body and just use commit info")
prCreateCmd.Flags().StringSliceP("reviewers", "r", nil, "Request reviews from people by their `login`")
prCreateCmd.Flags().StringSliceP("assignees", "a", nil, "Assign people by their `login`")
prCreateCmd.Flags().StringSliceP("labels", "l", nil, "Add labels by `name`")
prCreateCmd.Flags().StringSliceP("projects", "p", nil, "Add the pull request to projects by `name`")
prCreateCmd.Flags().StringSliceP("reviewer", "r", nil, "Request a review from someone by their `login`")
prCreateCmd.Flags().StringSliceP("assignee", "a", nil, "Assign a person by their `login`")
prCreateCmd.Flags().StringSliceP("label", "l", nil, "Add a label by `name`")
prCreateCmd.Flags().StringSliceP("project", "p", nil, "Add the pull request to a project by `name`")
prCreateCmd.Flags().StringP("milestone", "m", "", "Add the pull request to a milestone by `name`")
}