-
Notifications
You must be signed in to change notification settings - Fork 124
History improvements #645
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
History improvements #645
Conversation
Codecov Report
@@ Coverage Diff @@
## master #645 +/- ##
=========================================
- Coverage 94.31% 94.3% -0.01%
=========================================
Files 11 11
Lines 3058 3057 -1
=========================================
- Hits 2884 2883 -1
Misses 174 174
Continue to review full report at Codecov.
|
tleonhardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following should be fixed:
- flake8 error due to assigned but unused variable
- incorrectly treating a span-end negative index as exclusive
We should research and see if there is a way around the weird argparse behavior where it is treating a positional argument starting with a "-" as a flag.
tleonhardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend fixing the one flake8 error I found on my system. Other than that, nice work - particularly in the documentation arena.
|
Make surge a single ending negative index in a span works correctly. Other than that looks good I think. |
|
@tleonhardt, as I understand your feedback, an ending negative index should include the referenced item. If I had four items in the history, and typed Here was my thinking when I implemented the current behavior. Python's native zero-based indices have If we shift the positive indices to the left to make them 1 based, should we not also shift the negative indices to the left on my lame ASCII chart as well? If we don't, then the size of the slice returned by I am open to either solution, but just wanted to explain my thinking. Lemme know if you still think I should make the requested modification, and I'll be happy to do it. |
|
@kotfu In Python, list indexing is 0-based and list slicing is inclusive of the start index and exclusive of the end index. In Bash, the history command there is no slicing or range extraction - In the I'm pretty flexible to how we do things, I just want to make sure we are internally logically consistent and well documented. Three possibilities I see include:
What do you folks think? |
|
After thinking about it for a day, I think I like option #1. It's much easier to explain to a regular person that "1 is the first command, -1 is the last command. 2 is the second command, -2 is the second to last command." Having it be inclusive make it nice and easy to explain, and I'm a big fan of clarity. I'll make the change and get it pushed so you can review. |
…ad of excluding it
|
I did some manual testing and am now very happy with the way things work in this PR. Nice job! |
Improve history and associated documentation as discussed in #640 and #641.
Closes #640
Closes #641