jshon icon indicating copy to clipboard operation
jshon copied to clipboard

-d negative index not working

Open amerlyq opened this issue 8 years ago • 2 comments

In man for -d we have Negative array indexes will wrap around. Trying $ echo '[1,2,3]' | jshon -d -1

[
 1,
 2,
 3
]

Did I misinterpreted man?

amerlyq avatar Aug 21 '16 13:08 amerlyq

This appears to work if it wraps around to the first element, but that's not very useful:

$ echo '[1,2,3]' | jshon -d -3
[
 2,
 3
]

jmetzmeier avatar Aug 22 '16 23:08 jmetzmeier

Yes, it's not useful at all -- I have different structure in last element and must drop it before applying -a to rest. Without negative indexes it's relatively cumbersome task. I hope there is way to fix it at least.

On Tue, Aug 23, 2016, 02:04 Jordan Metzmeier [email protected] wrote:

This appears to work if it wraps around to the first element, but that's not very useful:

$ echo '[1,2,3]' | jshon -d -3 [ 2, 3 ]

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/keenerd/jshon/issues/47#issuecomment-241577806, or mute the thread https://github.com/notifications/unsubscribe-auth/AFdvMOW1xa8s0zcpzjqkj0-xnsA96TMyks5qiisBgaJpZM4JpTXo .

amerlyq avatar Aug 23 '16 02:08 amerlyq