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

Fix piping input from json #56

Closed
wants to merge 3 commits into from
Closed

Fix piping input from json #56

wants to merge 3 commits into from

Conversation

DrSensor
Copy link

@DrSensor DrSensor commented Jun 17, 2019

Description

This PR will enable the CLI to accept json from process.stdin

echo '{"states":[]}' | ./bin/smcat

Motivation and Context

Currently, this is what happens:

$ echo '{"states":[]}' | smcat

syntax error on line 1, column 1:
Expected comment, end of input, line end, or whitespace but "{" found.

How Has This Been Tested?

(Testing CLI apps is always tricky, especially this one which I don't know how to do it. Please let me know if you have some tips 🙂)

Screenshots (if appropriate):

Before

Peek 2019-06-17 07-02

After

Peek 2019-06-17 07-06

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • The code I add will be subject to The MIT license, and I'm OK with that.
  • The code I've added is my own original work.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

echo '{"states":[]}' | ./bin/smcat
@sverweij
Copy link
Owner

hi @DrSensor - thanks for this PR. Before I dive into the details - have you tried using --input-type on the command line? e.g.

echo '{"states":[]}' | ./bin/smcat --input-type json

@sverweij
Copy link
Owner

Dôh - I now see; smcat ignores the --input-type option altogether, reading from stdin or otherwise.

@sverweij
Copy link
Owner

sverweij commented Jun 17, 2019

... that means this PR is not going to work, until that is fixed. I've created an issue (#57) and a fix for it (#58 )

@DrSensor
Copy link
Author

Thanks, that will do. I will close this now

@DrSensor DrSensor closed this Jun 17, 2019
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.

None yet

2 participants