Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up📦 NEW: Reverse order of output #40
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
|
Thank you, Ashar! Please update the PR in light of the latest release.
|
This comment has been minimized.
This comment has been minimized.
|
Just updated the PR with the latest release. |
| @@ -16,6 +16,7 @@ module.exports = meow( | |||
| Options | |||
| ${yellow(`--xcolor`)}, ${yellow(`-x`)} Single colored output | |||
| ${yellow(`--sort`)}, ${yellow(`-s`)} Sort data by type | |||
| ${yellow(`--reverse`)}, ${yellow(`-r`)} Reverse the order of sorted data | |||
This comment has been minimized.
This comment has been minimized.
| @@ -41,6 +42,10 @@ module.exports = meow( | |||
| type: "string", | |||
| default: "cases", | |||
| alias: "s" | |||
| }, | |||
| reverse: { | |||
| type: "string", | |||
This comment has been minimized.
This comment has been minimized.
| @@ -15,7 +15,11 @@ module.exports = async (spinner, table, states, countryName, sortBy) => { | |||
| let allCountries = response.data; | |||
|
|
|||
| // Sort. | |||
| allCountries = orderBy(allCountries, [sortingKeys[sortBy]], ["desc"]); | |||
| if ( reverse !== undefined ) { | |||
This comment has been minimized.
This comment has been minimized.
| @@ -35,6 +39,9 @@ module.exports = async (spinner, table, states, countryName, sortBy) => { | |||
|
|
|||
| spinner.stopAndPersist(); | |||
| spinner.info(`${chalk.cyan(`Sorted by:`)} ${sortBy}`); | |||
| if ( reverse !== undefined ) { | |||
| spinner.info(`${chalk.cyan(`Order:`)} reverse`); | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Thank you, Ashar. Accepting the PR but do read the comments. I'll address them myself. |
This comment has been minimized.
This comment has been minimized.
|
Also why is reverse a string? |
This comment has been minimized.
This comment has been minimized.
|
Done
Check out the final code. |
Inukares
added a commit
to Inukares/corona-cli
that referenced
this pull request
Mar 25, 2020
*📦 NEW: Reverse sorting flag *📦 NEW: Reverse data sorting using reverse flag *📖 DOC: Reverse sorting
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
asharirfan commentedMar 24, 2020
Description
This PR adds
--reverseflag to the CLI, which reverses the order of output.Usage
Applicable Issues
#23