mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
fix(app): pretty-print JSON on a terminal and reconcile the foundation streams
writeJSON uses the indented, colored JSON writer when stdout is a terminal. Help and JSON tests now expect the -L shorthand column and compare terminal JSON without color sequences. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
4 files changed
+17
-8
No files matched your search
@@ -250,7 +250,7 @@ func TestCommandHelpShowsRelevantFlagsOnly(t *testing.T) {
|
||||
for _, want := range []string{
|
||||
"\nUSAGE\n tea issue list [flags]\n",
|
||||
"\nALIASES\n tea issue ls\n",
|
||||
"\nFLAGS\n --assignee string ",
|
||||
"\nFLAGS\n --assignee string ",
|
||||
"\nINHERITED FLAGS\n -R, --repo OWNER/REPO ",
|
||||
"\n --json fields ",
|
||||
"\n -q, --jq expression ",
|
||||
@@ -264,7 +264,7 @@ func TestCommandHelpShowsRelevantFlagsOnly(t *testing.T) {
|
||||
}
|
||||
out.Reset()
|
||||
require.NoError(t, Execute(context.Background(), deps, []string{"label", "list", "--help"}))
|
||||
require.Contains(t, out.String(), "\nFLAGS\n --limit int Maximum results (1..100) (default 30)\n --org string ")
|
||||
require.Contains(t, out.String(), "\nFLAGS\n -L, --limit int Maximum number of results (1..1000) (default 30)\n --org string ")
|
||||
for _, args := range [][]string{{"version", "--help"}, {"alias", "list", "--help"}, {"auth", "status", "--help"}} {
|
||||
out.Reset()
|
||||
require.NoError(t, Execute(context.Background(), deps, args))
|
||||
|
||||
Reference in new issue
Block a user