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

Add an option to output the result as JSON #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yardnsm
Copy link

@yardnsm yardnsm commented Mar 24, 2018

This PR attempts to resolve #9.

TODO

  • Output module occurrences as JSON
  • Output errors as JSON

For some reason, commander does not let me to set an option named --json inside a command, so currently I'm calling it --json-output: https://github.com/yardnsm/qnm/blob/b2079057f791f379eb4a4d2135c55c490b1103ba/src/cli.js#L19

Copy link
Owner

@ranyitz ranyitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, thanks ❤️

LGTM, just change the option from --json-output to --json and let's merge :)

src/cli.js Outdated
@@ -16,9 +16,10 @@ try {
.version(pkg.version)
.command('list')
.description('list all node_modules with their versions')
.action(() => {
.option('--json-output', 'output results as json')
.action(({ jsonOutput: json }) => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can get it by using:

program.json

I think the other command (qnm [module]) catches this option. Maybe we should find a better solution for that.

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

Successfully merging this pull request may close these issues.

Add an option to output as JSON
2 participants