-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add new count parameter: #15
Add new count parameter: #15
Conversation
add new count parameter. It's number of sorted results. It can be useful for a large number of identical results. It's acceptable to use numbers with minus sign(-5 as example), then results will be from the end of results list.
Hi, thanks for the PR, in order to better review it I have a few initial comments/questions:
|
add new count parameter to print the number of results. Useful for a lot of identical results
add new count parameter to print the number of results. Useful for a lot of identical results
As instance:
|
if isinstance(count, int): | ||
length = len(results) | ||
if count >= 0: | ||
_ = [0, length and count] |
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.
_
as a var has different meanings depending on context (most common one being "please, ignore") so I'd suggest not using it
So if I understood you correctly, the basic idea is to "hide" identical results to simplify the output. I think this is very useful and I am completely on board with this feature. However, looking at the PR I am not sure these changes achieve such goal. Imagine the following situation. I run some task over 100 devices that I expect to lead to the same result so I run
I think if we want to really implement this sort of functionality we need to:
Rather than implementing my suggestion as part of Did I misunderstand anything? Thoughts? |
It's a good idea, but my idea is much simpler. I just wanted to be able to limit the amount of output to the terminal without changing the terminal settings (scrollback settings), but at the same time see some results. If there are errors on some hosts, then to avoid looking at the entire I replaced all new functions to single PR with |
update
print_result
function:count
parameter. It's number of sorted results. It can be useful for a large number of identical results. It's acceptable to use numbers with minus sign(-5 as example), then results will be from the end of results listprint_host
- print host or not