Updates following renaming domain to shared
This commit is contained in:
parent
f941608091
commit
11ce0c661c
4 changed files with 12 additions and 12 deletions
|
|
@ -63,7 +63,7 @@ func NewCmdList(f *cmdutil.Factory, runF func(*listOptions) error) *cobra.Comman
|
|||
}
|
||||
|
||||
cmd.Flags().BoolVarP(&opts.WebMode, "web", "w", false, "List autolink references in the web browser")
|
||||
cmdutil.AddJSONFlags(cmd, &opts.Exporter, domain.AutolinkFields)
|
||||
cmdutil.AddJSONFlags(cmd, &opts.Exporter, shared.AutolinkFields)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ import (
|
|||
"github.com/cli/cli/v2/api"
|
||||
"github.com/cli/cli/v2/internal/ghinstance"
|
||||
"github.com/cli/cli/v2/internal/ghrepo"
|
||||
"github.com/cli/cli/v2/pkg/cmd/repo/autolink/domain"
|
||||
"github.com/cli/cli/v2/pkg/cmd/repo/autolink/shared"
|
||||
)
|
||||
|
||||
type AutolinkViewer struct {
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
func (a *AutolinkViewer) View(repo ghrepo.Interface, id string) (*domain.Autolink, error) {
|
||||
func (a *AutolinkViewer) View(repo ghrepo.Interface, id string) (*shared.Autolink, error) {
|
||||
path := fmt.Sprintf("repos/%s/%s/autolinks/%s", repo.RepoOwner(), repo.RepoName(), id)
|
||||
url := ghinstance.RESTPrefix(repo.RepoHost()) + path
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
|
|
@ -35,7 +35,7 @@ func (a *AutolinkViewer) View(repo ghrepo.Interface, id string) (*domain.Autolin
|
|||
return nil, api.HandleHTTPError(resp)
|
||||
}
|
||||
|
||||
var autolink domain.Autolink
|
||||
var autolink shared.Autolink
|
||||
err = json.NewDecoder(resp.Body).Decode(&autolink)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/MakeNowJust/heredoc"
|
||||
"github.com/cli/cli/v2/internal/browser"
|
||||
"github.com/cli/cli/v2/internal/ghrepo"
|
||||
"github.com/cli/cli/v2/pkg/cmd/repo/autolink/domain"
|
||||
"github.com/cli/cli/v2/pkg/cmd/repo/autolink/shared"
|
||||
"github.com/cli/cli/v2/pkg/cmdutil"
|
||||
"github.com/cli/cli/v2/pkg/iostreams"
|
||||
"github.com/spf13/cobra"
|
||||
|
|
@ -23,7 +23,7 @@ type viewOptions struct {
|
|||
}
|
||||
|
||||
type AutolinkViewClient interface {
|
||||
View(repo ghrepo.Interface, id string) (*domain.Autolink, error)
|
||||
View(repo ghrepo.Interface, id string) (*shared.Autolink, error)
|
||||
}
|
||||
|
||||
func NewCmdView(f *cmdutil.Factory, runF func(*viewOptions) error) *cobra.Command {
|
||||
|
|
@ -65,7 +65,7 @@ func NewCmdView(f *cmdutil.Factory, runF func(*viewOptions) error) *cobra.Comman
|
|||
},
|
||||
}
|
||||
|
||||
cmdutil.AddJSONFlags(cmd, &opts.Exporter, domain.AutolinkFields)
|
||||
cmdutil.AddJSONFlags(cmd, &opts.Exporter, shared.AutolinkFields)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/MakeNowJust/heredoc"
|
||||
"github.com/cli/cli/v2/internal/browser"
|
||||
"github.com/cli/cli/v2/internal/ghrepo"
|
||||
"github.com/cli/cli/v2/pkg/cmd/repo/autolink/domain"
|
||||
"github.com/cli/cli/v2/pkg/cmd/repo/autolink/shared"
|
||||
"github.com/cli/cli/v2/pkg/cmdutil"
|
||||
"github.com/cli/cli/v2/pkg/iostreams"
|
||||
"github.com/cli/cli/v2/pkg/jsonfieldstest"
|
||||
|
|
@ -97,11 +97,11 @@ func TestNewCmdView(t *testing.T) {
|
|||
}
|
||||
|
||||
type stubAutoLinkViewer struct {
|
||||
autolink *domain.Autolink
|
||||
autolink *shared.Autolink
|
||||
err error
|
||||
}
|
||||
|
||||
func (g stubAutoLinkViewer) View(repo ghrepo.Interface, id string) (*domain.Autolink, error) {
|
||||
func (g stubAutoLinkViewer) View(repo ghrepo.Interface, id string) (*shared.Autolink, error) {
|
||||
return g.autolink, g.err
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ func TestViewRun(t *testing.T) {
|
|||
ID: "1",
|
||||
},
|
||||
stubViewer: stubAutoLinkViewer{
|
||||
autolink: &domain.Autolink{
|
||||
autolink: &shared.Autolink{
|
||||
ID: 1,
|
||||
KeyPrefix: "TICKET-",
|
||||
URLTemplate: "https://example.com/TICKET?query=<num>",
|
||||
|
|
@ -152,7 +152,7 @@ func TestViewRun(t *testing.T) {
|
|||
}(),
|
||||
},
|
||||
stubViewer: stubAutoLinkViewer{
|
||||
autolink: &domain.Autolink{
|
||||
autolink: &shared.Autolink{
|
||||
ID: 1,
|
||||
KeyPrefix: "TICKET-",
|
||||
URLTemplate: "https://example.com/TICKET?query=<num>",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue