Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on negative list index - could traverse backwards instead #398

Closed
krangerich opened this issue Mar 28, 2020 · 1 comment
Closed

Crash on negative list index - could traverse backwards instead #398

krangerich opened this issue Mar 28, 2020 · 1 comment

Comments

@krangerich
Copy link

Describe the bug
When you specify a negative list index, for example "yr r data1.yaml foo[-1]", the program crashes with a stack trace

Input Yaml
data1.yml:

foo:
- bar: baz

Command
The command you ran:

yq r data1.yaml foo[-1]

Actual behavior

runtime error with stack trace

Expected behavior

Print an error message
OR
implement new feature like "-1 means last item of the list"

@krangerich krangerich added the bug label Mar 28, 2020
@mikefarah
Copy link
Owner

Ooh I like negative indexes for going backwards, that would be cool.

@mikefarah mikefarah changed the title Crash on negative list index Crash on negative list index - could traverse backwards instead Mar 31, 2020
@mikefarah mikefarah added this to the 3.2.2 milestone Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants