-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
NEW: Add omit column feature #46
base: master
Are you sure you want to change the base?
Conversation
* 📦 NEW: Reverse sorting flag * 📦 NEW: Reverse data sorting using reverse flag * 📖 DOC: Reverse sorting
Co-authored-by: Firas Dib <firas@consid.se>
* 📦 NEW: NonVerbose * 👌 IMPROVE: Rename option Co-authored-by: Touch Sungkawichai <mb99n@Touchs-MacBook-Pro.local> Co-authored-by: Ahmad Awais ⚡️ <me@AhmadAwais.com>
--omit=cases_cases-today_wrongINput_deaths will omit all valid keys wrong keys will simply be ignored
� Conflicts: � changelog.md � index.js � package.json � utils/cli.js � utils/getCountries.js � utils/getCountry.js � utils/getStates.js
const states = input === 'states' ? true : false; | ||
const states = input === 'states'; |
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.
It's the same code written simpler.
const table = !states | ||
? new Table({ head, style, chars: border }) | ||
: new Table({ head: headStates, style, chars: border }); | ||
const tableHead = states ? headStates : head; | ||
const table = new Table({ head: tableHead, style, chars: border }); |
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.
logic for table was complex - it started with negation even though there was no real reason for it. As I needed this piece of code I refactored it a little bit for easier maintenance.
await getCountry(spinner, table, states, country); | ||
await getStates(spinner, table, states, options); | ||
await getCountries(spinner, table, states, country, options); | ||
await getCountry({ spinner, table, states, country, tableHead }); | ||
await getStates({ spinner, table, states, options, tableHead }); | ||
await getCountries({ spinner, table, states, country, options, tableHead }); |
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.
Due to multiple parameters I refactored getCountry
, getStates
and getCountries
to accept object.
It is a good idea to use "comma" separated list as it has common use in cli list parameters |
Closes #47
First of all, I'd like to say I'm extremely happy to participate in this cool project, great idea @ahmadawais!
This pull request enables feature to omit whole column(s) from output, separated by
_
.Wrong keys are simply ignored.