You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
choose helpfully offers compatibility with Python's style of 0-indexing, inclusive start, and exclusive end, with -x (which the docs make sound like it uses an exclusive range, while it uses an inclusive start):
Since the context I'd use choose in is the same I'd use ZSH and cut in, it would lessen the mental load and chance of user error if I could get it to match the indexing and slicing of ZSH (default config) and cut.
Here's the same data as a table, where s is an array of the numbers 1 through 6:
Context
Command
Result
Index
Start
End
python
s[2:4]
(3, 4)
0
Inclusive
Exclusive
zsh
print $s[2,4]
2 3 4
1
Inclusive
Inclusive
cut
print $s | cut -d' ' -f2-4
2 3 4
1
Inclusive
Inclusive
choose
print $s | choose 2:4
3 4 5
0
Inclusive
Inclusive
choose
print $s | choose -x 2:4
3 4
0
Inclusive
Exclusive
The text was updated successfully, but these errors were encountered:
choose
helpfully offers compatibility with Python's style of 0-indexing, inclusive start, and exclusive end, with-x
(which the docs make sound like it uses an exclusive range, while it uses an inclusive start):But when I'm in a shell, using ZSH tools,
cut
, etc., I expect 1-indexing, inclusive start, inclusive end:Since the context I'd use
choose
in is the same I'd use ZSH andcut
in, it would lessen the mental load and chance of user error if I could get it to match the indexing and slicing of ZSH (default config) andcut
.Here's the same data as a table, where
s
is an array of the numbers1
through6
:python
s[2:4]
(3, 4)
0
zsh
print $s[2,4]
2 3 4
1
cut
print $s | cut -d' ' -f2-4
2 3 4
1
choose
print $s | choose 2:4
3 4 5
0
choose
print $s | choose -x 2:4
3 4
0
The text was updated successfully, but these errors were encountered: