Merge branch 'trunk' into add-issue-create-editor
This commit is contained in:
commit
ae5a71bbe4
6 changed files with 141 additions and 9 deletions
|
|
@ -16,11 +16,37 @@ import (
|
|||
"github.com/cli/cli/v2/pkg/cmdutil"
|
||||
"github.com/cli/cli/v2/pkg/httpmock"
|
||||
"github.com/cli/cli/v2/pkg/iostreams"
|
||||
"github.com/cli/cli/v2/pkg/jsonfieldstest"
|
||||
"github.com/cli/cli/v2/test"
|
||||
"github.com/google/shlex"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestJSONFields(t *testing.T) {
|
||||
jsonfieldstest.ExpectCommandToSupportJSONFields(t, NewCmdView, []string{
|
||||
"assignees",
|
||||
"author",
|
||||
"body",
|
||||
"closed",
|
||||
"comments",
|
||||
"createdAt",
|
||||
"closedAt",
|
||||
"id",
|
||||
"labels",
|
||||
"milestone",
|
||||
"number",
|
||||
"projectCards",
|
||||
"projectItems",
|
||||
"reactionGroups",
|
||||
"state",
|
||||
"title",
|
||||
"updatedAt",
|
||||
"url",
|
||||
"isPinned",
|
||||
"stateReason",
|
||||
})
|
||||
}
|
||||
|
||||
func runCommand(rt http.RoundTripper, isTTY bool, cli string) (*test.CmdOut, error) {
|
||||
ios, _, stdout, stderr := iostreams.Test()
|
||||
ios.SetStdoutTTY(isTTY)
|
||||
|
|
|
|||
|
|
@ -18,12 +18,61 @@ import (
|
|||
"github.com/cli/cli/v2/pkg/cmdutil"
|
||||
"github.com/cli/cli/v2/pkg/httpmock"
|
||||
"github.com/cli/cli/v2/pkg/iostreams"
|
||||
"github.com/cli/cli/v2/pkg/jsonfieldstest"
|
||||
"github.com/cli/cli/v2/test"
|
||||
"github.com/google/shlex"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestJSONFields(t *testing.T) {
|
||||
jsonfieldstest.ExpectCommandToSupportJSONFields(t, NewCmdView, []string{
|
||||
"additions",
|
||||
"assignees",
|
||||
"author",
|
||||
"autoMergeRequest",
|
||||
"baseRefName",
|
||||
"body",
|
||||
"changedFiles",
|
||||
"closed",
|
||||
"closedAt",
|
||||
"comments",
|
||||
"commits",
|
||||
"createdAt",
|
||||
"deletions",
|
||||
"files",
|
||||
"headRefName",
|
||||
"headRefOid",
|
||||
"headRepository",
|
||||
"headRepositoryOwner",
|
||||
"id",
|
||||
"isCrossRepository",
|
||||
"isDraft",
|
||||
"labels",
|
||||
"latestReviews",
|
||||
"maintainerCanModify",
|
||||
"mergeCommit",
|
||||
"mergeStateStatus",
|
||||
"mergeable",
|
||||
"mergedAt",
|
||||
"mergedBy",
|
||||
"milestone",
|
||||
"number",
|
||||
"potentialMergeCommit",
|
||||
"projectCards",
|
||||
"projectItems",
|
||||
"reactionGroups",
|
||||
"reviewDecision",
|
||||
"reviewRequests",
|
||||
"reviews",
|
||||
"state",
|
||||
"statusCheckRollup",
|
||||
"title",
|
||||
"updatedAt",
|
||||
"url",
|
||||
})
|
||||
}
|
||||
|
||||
func Test_NewCmdView(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
|
|
|||
|
|
@ -88,6 +88,9 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
|
|||
To create a remote repository non-interactively, supply the repository name and one of %[1]s--public%[1]s, %[1]s--private%[1]s, or %[1]s--internal%[1]s.
|
||||
Pass %[1]s--clone%[1]s to clone the new repository locally.
|
||||
|
||||
If the %[1]sOWNER/%[1]s portion of the %[1]sOWNER/REPO%[1]s name argument is omitted, it
|
||||
defaults to the name of the authenticating user.
|
||||
|
||||
To create a remote repository from an existing local repository, specify the source directory with %[1]s--source%[1]s.
|
||||
By default, the remote repository name will be the name of the source directory.
|
||||
Pass %[1]s--push%[1]s to push any local commits to the new repository.
|
||||
|
|
@ -99,6 +102,9 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
|
|||
# create a new remote repository and clone it locally
|
||||
gh repo create my-project --public --clone
|
||||
|
||||
# create a new remote repository in a different organization
|
||||
gh repo create my-org/my-project --public
|
||||
|
||||
# create a remote repository from the current directory
|
||||
gh repo create my-project --private --source=. --remote=upstream
|
||||
`),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue