Support reversing the order of displayed results #18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Example Use Case:
I wanted to display a query showing the 100 most recent commands, but displayed in ascending chronological order. If I configured the
ORDER BY
clause of the SQL to sort in chronological order, the--limit 100
parameter would give me the oldest 100 commands, not the most recent. Alternatively, if I configured theORDER BY
clause to sort in reverse chronological order, the--limit 100
parameter would correctly give me the most recent 100 commands. However, they would be displayed in reverse chronological order, with the most recent commands scrolling off the screen.Proposed Solution in this PR:
The proposed solution in this pull request is to add a
--reverse
flag toash_query
andash_query.py
to control the order in which the query results are displayed.This way, for my example use case above, I could configure the
ORDER BY
clause to sort in reverse chronological order, let the--limit
be applied to return the most recent set of commands, and then let the--reverse
flag apply to display them in ascending chronological order.Example:
queries
: (queries commands in reverse chronological order)Query:
Results (reverse chronological order):
Query with reverse:
Results with reverse (ascendig chronological order):