@@ -227,7 +227,7 @@ func issueList(cmd *cobra.Command, args []string) error {
227227 }
228228
229229 if web {
230- issueListURL := generateRepoURL (baseRepo , "issues" )
230+ issueListURL := ghrepo . GenerateRepoURL (baseRepo , "issues" )
231231 openURL , err := listURLWithQuery (issueListURL , filterOptions {
232232 entity : "issue" ,
233233 state : state ,
@@ -240,7 +240,7 @@ func issueList(cmd *cobra.Command, args []string) error {
240240 if err != nil {
241241 return err
242242 }
243- fmt .Fprintf (cmd .ErrOrStderr (), "Opening %s in your browser.\n " , displayURL (openURL ))
243+ fmt .Fprintf (cmd .ErrOrStderr (), "Opening %s in your browser.\n " , utils . DisplayURL (openURL ))
244244 return utils .OpenInBrowser (openURL )
245245 }
246246
@@ -504,7 +504,7 @@ func issueCreate(cmd *cobra.Command, args []string) error {
504504 }
505505
506506 if isWeb , err := cmd .Flags ().GetBool ("web" ); err == nil && isWeb {
507- openURL := generateRepoURL (baseRepo , "issues/new" )
507+ openURL := ghrepo . GenerateRepoURL (baseRepo , "issues/new" )
508508 if title != "" || body != "" {
509509 milestone := ""
510510 if len (milestoneTitles ) > 0 {
@@ -518,7 +518,7 @@ func issueCreate(cmd *cobra.Command, args []string) error {
518518 openURL += "/choose"
519519 }
520520 if connectedToTerminal (cmd ) {
521- cmd .Printf ("Opening %s in your browser.\n " , displayURL (openURL ))
521+ cmd .Printf ("Opening %s in your browser.\n " , utils . DisplayURL (openURL ))
522522 }
523523 return utils .OpenInBrowser (openURL )
524524 }
@@ -582,7 +582,7 @@ func issueCreate(cmd *cobra.Command, args []string) error {
582582 }
583583
584584 if action == PreviewAction {
585- openURL := generateRepoURL (baseRepo , "issues/new" )
585+ openURL := ghrepo . GenerateRepoURL (baseRepo , "issues/new" )
586586 milestone := ""
587587 if len (milestoneTitles ) > 0 {
588588 milestone = milestoneTitles [0 ]
@@ -592,7 +592,7 @@ func issueCreate(cmd *cobra.Command, args []string) error {
592592 return err
593593 }
594594 // TODO could exceed max url length for explorer
595- fmt .Fprintf (cmd .ErrOrStderr (), "Opening %s in your browser.\n " , displayURL (openURL ))
595+ fmt .Fprintf (cmd .ErrOrStderr (), "Opening %s in your browser.\n " , utils . DisplayURL (openURL ))
596596 return utils .OpenInBrowser (openURL )
597597 } else if action == SubmitAction {
598598 params := map [string ]interface {}{
@@ -618,14 +618,6 @@ func issueCreate(cmd *cobra.Command, args []string) error {
618618 return nil
619619}
620620
621- func generateRepoURL (repo ghrepo.Interface , p string , args ... interface {}) string {
622- baseURL := fmt .Sprintf ("https://%s/%s/%s" , repo .RepoHost (), repo .RepoOwner (), repo .RepoName ())
623- if p != "" {
624- return baseURL + "/" + fmt .Sprintf (p , args ... )
625- }
626- return baseURL
627- }
628-
629621func addMetadataToIssueParams (client * api.Client , baseRepo ghrepo.Interface , params map [string ]interface {}, tb * issueMetadataState ) error {
630622 if ! tb .HasMetadata () {
631623 return nil
@@ -844,11 +836,3 @@ func issueReopen(cmd *cobra.Command, args []string) error {
844836
845837 return nil
846838}
847-
848- func displayURL (urlStr string ) string {
849- u , err := url .Parse (urlStr )
850- if err != nil {
851- return urlStr
852- }
853- return u .Hostname () + u .Path
854- }
0 commit comments