Skip to content

Commit 5b2a88f

Browse files
night556JacksonTian
authored andcommitted
Remove the RootFilter[0] input at field rows=
1 parent 5da59f4 commit 5b2a88f

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
### Master :
44

5+
- Remove the `RootFilter[0]` input at field `rows=` that confuses the user
6+
> The previous `rows` field requires the user to enter `RootFilter[0]`, which will cause confusion for the user and has been deleted.
7+
>example:
8+
> >`aliyun ecs DescribeRegions --output cols=RequestId`
9+
10+
> >`aliyun ecs DescribeRegions --output cols=RegionId rows=Regions.Region`
511
- flag `--pager` can specified collections path
612
- add row number for flag `--output` output format.
713
> If you want show row number at output format, you can use field `num=ture` after flag `--output` to enable the num.

openapi/output_filter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (a *TableOutputFilter) FilterOutput(s string) (string, error) {
6666

6767
rowPath := detectArrayPath(v)
6868
if v, ok := OutputFlag(a.ctx.Flags()).GetFieldValue("rows"); ok {
69-
rowPath = v
69+
rowPath = "RootFilter[0]." + v
7070
} else {
7171
rowPath = "RootFilter"
7272
}

openapi/output_filter_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func TestNewTableOutputFilter(t *testing.T) {
4949
OutputFlag(tableout.ctx.Flags()).Fields[1].SetAssigned(true)
5050
str, err = tableout.FilterOutput(content)
5151
assert.NotNil(t, `{"path":"/User"}`, err)
52-
assert.Equal(t, "jmespath: '' failed SyntaxError: Incomplete expression", err.Error())
52+
assert.Equal(t, "jmespath: 'RootFilter[0].' failed SyntaxError: Expected identifier, lbracket, or lbrace", err.Error())
5353
}
5454

5555
func TestTableOutputFilter_FormatTable(t *testing.T) {

0 commit comments

Comments
 (0)