Skip to content
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

Open
wants to merge 22 commits into
base: master
from
Open

Conversation

@Inukares
Copy link

Inukares commented Mar 25, 2020


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 enabled feature to omit whole column(s) from output, separated by _.

Locally running:

node index.js --omit=cases_cases-today

Wrong keys are simply ignored.

node index.js --o=wrongKeyNothingHappens_deaths
Inukares and others added 22 commits Mar 25, 2020
* 📦 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';
Comment on lines -41 to +41

This comment has been minimized.

Copy link
@Inukares

Inukares Mar 25, 2020

Author

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 });
Comment on lines -48 to +50

This comment has been minimized.

Copy link
@Inukares

Inukares Mar 25, 2020

Author

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 });
Comment on lines -55 to +57

This comment has been minimized.

Copy link
@Inukares

Inukares Mar 25, 2020

Author

Due to multiple parameters I refactored getCountry, getStates and getCountries to accept object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.