Compare commits

...

3 Commits

Author SHA1 Message Date
dependabot[bot]
9ce30b89b7
Merge 9883ebc313 into 23060cb8af 2025-09-19 22:33:46 +02:00
Mike Farah
23060cb8af Improving first op docs 2025-09-19 14:59:19 +10:00
dependabot[bot]
9883ebc313
Bump softprops/action-gh-release from 1 to 2
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-14 03:40:51 +00:00
3 changed files with 11 additions and 48 deletions

View File

@ -44,7 +44,7 @@ jobs:
./scripts/xcompile.sh
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: build/*
draft: true

View File

@ -273,7 +273,7 @@ will output
100
```
## First element with no RHS from array
## First element with no filter from array
Given a sample.yml file of:
```yaml
- 10
@ -289,7 +289,7 @@ will output
10
```
## First element with no RHS from array of maps
## First element with no filter from array of maps
Given a sample.yml file of:
```yaml
- a: 10
@ -304,42 +304,3 @@ will output
a: 10
```
## No RHS on empty array returns nothing
Given a sample.yml file of:
```yaml
[]
```
then
```bash
yq 'first' sample.yml
```
will output
```yaml
```
## No RHS on scalar returns nothing
Given a sample.yml file of:
```yaml
hello
```
then
```bash
yq 'first' sample.yml
```
will output
```yaml
```
## No RHS on null returns nothing
Given a sample.yml file of:
```yaml
null
```
then
```bash
yq 'first' sample.yml
```
will output
```yaml
```

View File

@ -139,9 +139,8 @@ var firstOperatorScenarios = []expressionScenario{
"D0, P[1], (!!int)::100\n",
},
},
// New tests for no RHS (return first child)
{
description: "First element with no RHS from array",
description: "First element with no filter from array",
document: "[10, 100, 1]",
expression: `first`,
expected: []string{
@ -149,7 +148,7 @@ var firstOperatorScenarios = []expressionScenario{
},
},
{
description: "First element with no RHS from array of maps",
description: "First element with no filter from array of maps",
document: "[{a: 10},{a: 100}]",
expression: `first`,
expected: []string{
@ -157,19 +156,22 @@ var firstOperatorScenarios = []expressionScenario{
},
},
{
description: "No RHS on empty array returns nothing",
description: "No filter on empty array returns nothing",
skipDoc: true,
document: "[]",
expression: `first`,
expected: []string{},
},
{
description: "No RHS on scalar returns nothing",
description: "No filter on scalar returns nothing",
skipDoc: true,
document: "hello",
expression: `first`,
expected: []string{},
},
{
description: "No RHS on null returns nothing",
description: "No filter on null returns nothing",
skipDoc: true,
document: "null",
expression: `first`,
expected: []string{},