mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
fix(repo): reject --repo on commands that act on no repository
tea repo list -R acme/service listed the account's repositories and tea repo create foo -R alice/project created alice/foo: the flag was silently ignored. repo list, repo create, repo migrate and search repo now fail with a usage error that suggests the intended command, such as "--repo is not used by repo list; did you mean: tea repo list acme". repo list takes the owner as an argument (--owner still works), and repo create accepts OWNER/NAME, creating in the organization OWNER. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
7 files changed
+96
-7
No files matched your search
@@ -150,7 +150,7 @@ func TestUsageErrorsPrecedeRequests(t *testing.T) {
|
||||
{[]string{"release", "edit", "v1"}, "supply release fields to edit"},
|
||||
{[]string{"release", "edit", "v1", "v2", "--tag", "v3"}, "--tag requires one release and a nonempty new tag"},
|
||||
{[]string{"repo", "create"}, "missing required input: supply --name"},
|
||||
{[]string{"repo", "create", "bad/name"}, "repository name must be nonempty, at most 100 bytes, and contain no path separators or whitespace"},
|
||||
{[]string{"repo", "create", "acme/bad/name"}, "repository name must be nonempty, at most 100 bytes, and contain no path separators or whitespace"},
|
||||
{[]string{"repo", "create", "name", "--name", "other"}, "supply name as an argument or --name, not both"},
|
||||
{[]string{"repo", "create", "name", "--default-branch", "bad..branch", "--auto-init"}, "invalid branch name"},
|
||||
{[]string{"repo", "create", "name", "--license", "MIT"}, "initial content and default branch options require --auto-init"},
|
||||
@@ -161,7 +161,7 @@ func TestUsageErrorsPrecedeRequests(t *testing.T) {
|
||||
{[]string{"repo", "create", "name", "--copy-content=false"}, "copy options require --template owner/repo"},
|
||||
{[]string{"repo", "create", "name", "--template="}, "--template requires owner/repo or a repository URL"},
|
||||
{[]string{"repo", "create", "name", "--template", "owner/source", "--auto-init"}, "repository initialization options cannot be combined with --template"},
|
||||
{[]string{"repo", "create", "name", "--template", "owner/source", "-R", "owner/other"}, "--template and --repo cannot both select a source repository"},
|
||||
{[]string{"repo", "create", "name", "--template", "owner/source", "-R", "owner/other"}, "--repo is not used by repo create; did you mean: tea repo create owner/name"},
|
||||
{[]string{"repo", "edit", "--name="}, "repository name cannot be empty"},
|
||||
{[]string{"repo", "edit", "--default-branch="}, "default branch cannot be empty"},
|
||||
{[]string{"repo", "archive", "alice/project", "-R", "alice/other", "--yes"}, "supply the repository as an argument or --repo, not both"},
|
||||
|
||||
Reference in new issue
Block a user