mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
feat(app): report mutations on stderr and say what --web opens
Mutations printed a list row, or nothing, so a person could not tell what changed and scripts parsed rows meant for people. Commands now get the helpers for the gh convention: - done and warn print "✓ Closed issue alice/x#5 (Fix login)" and "! … is already closed" to stderr, only when stdout is a terminal and --json is not set. - printURL prints a created resource's URL to stdout unless --json is set, so url=$(tea issue create …) works. - batchDone applies a mutation to several selections like batch and reports each success with a done line instead of a table. - issueRef formats "alice/x#5 (title)" references. --web now prints "Opening localhost:3001/alice/project/issues/1 in your browser." to stderr on a terminal before the browser starts. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
4 files changed
+167
-12
No files matched your search
@@ -68,3 +68,21 @@ func TestDiscussionViewsShareBrowserContract(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpenBrowserTellsTerminalUsers(t *testing.T) {
|
||||
for _, tty := range []bool{true, false} {
|
||||
deps, out, diagnostics := testDeps(t)
|
||||
browser := &recordingBrowser{}
|
||||
deps.Browser = browser
|
||||
deps.Streams.OutTTY = tty
|
||||
a, cmd := outputApplication(deps, "")
|
||||
require.NoError(t, a.openBrowser(cmd, "http://localhost:3001/alice/project/issues/1"))
|
||||
require.Equal(t, "http://localhost:3001/alice/project/issues/1", browser.resource)
|
||||
require.Empty(t, out.String())
|
||||
if tty {
|
||||
require.Equal(t, "Opening localhost:3001/alice/project/issues/1 in your browser.\n", diagnostics.String())
|
||||
} else {
|
||||
require.Empty(t, diagnostics.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user