-
Notifications
You must be signed in to change notification settings - Fork 7
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
Adding CLI Streams #52
Conversation
@sarahsonder good progress.
|
…nto cli-streams
… into cli-streams
Pull Request Test Coverage Report for Build 10002435167Details
💛 - Coveralls |
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.
@sarahsonder great progress. I left one inline comment.
Regarding the issue of reading from stdin (on Windows), I looked into this a bit more. Definitely seems like Windows is a culprit here. For your implementation use streamConsumers.json
to streamline the process. When I tested it, the function worked when piping but I also was unable to signal an EOF when typing into the terminal.
We can accept that as a possible limitation for now, and please document this limitation.
Proposed Changes
This PR allows for new input and output streams to the CLI. Specifically, the
<file-to-path>
argument was made optional, allowing users to also usestdin
as input if a file path is not provided. Users can also redirect output to a location of their choice using--output<path>
or print the SVG directly to standard output.Type of Change
Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]
into a[x]
in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
Hi Professor Liu! So far, I have made the
--filepath
argument optional and I have also added the options--stdout
,--output
, and--stdin
. However, I have a few questions about the--stdin
option.npx memory-viz --stdin
, press enter, type in the json, and then press enter again to run memory-viz? I'm still working on getting input directly from the terminal, but I can currently get the commandWrite-Output '[{ "type": "int", "id": 13, "value": 7}]'| npx memory-viz --stdin --stdout
to work. For reference, I'm using Windows, hence theWrite-Output
command.--stdin
, what would you like the output file to be named? I currently have it named asmemory_viz.svg
--stdin
is chosen, there's won't be a default path. However, I believe that the default path is wherever memory-viz is being called becauseWrite-Output '[{ "type": "int", "id": 13, "value": 7}]'| npx memory-viz --stdin
outputs into my memory-viz folder. That being said, I could be mistaken and this might be different be for users.Thank you so much!