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

support for - as parameter #15

Open
ibeex opened this issue Mar 9, 2017 · 3 comments
Open

support for - as parameter #15

ibeex opened this issue Mar 9, 2017 · 3 comments

Comments

@ibeex
Copy link

ibeex commented Mar 9, 2017

as stated here https://docs.python.org/3/library/fileinput.html sometimes

echo 'one line' | python3 test.py - 
Fire trace:
1. Initial component
2. ('The function received no value for the required argument:', 'file_name')

should use std in instead file for input or output

@dbieber
Copy link
Member

dbieber commented Mar 9, 2017

Supporting piping is high on the requested features list. We don't have a final design in place yet for what the syntax will be, so I'm open to suggestions if you have ideas.

Some of the questions we have to answer:

  • How do you control which arguments use the piped input?
  • How is the piped input parsed?
  • Do the output serialization methods that Fire uses need to be updated to make piping work better?
    E.g. if a Fire CLI returns a dict and you pipe it to another Fire CLI that expects keyword args matching the dict's keys, maybe it would be good to pass the values from the dict by keyword.
    What if there isn't a clear mapping from the piped input to the receiving Fire command?

@dbieber
Copy link
Member

dbieber commented Mar 9, 2017

Oh! I misunderstood your request. You can use - as a parameter as long as you change the separator to something else.

e.g. "echo 'one line' | python3 test.py - -- --separator=X" should do the trick.
We don't have a supported way of changing the default separator at the moment.

@dbieber dbieber changed the title suport for - as parameter support for - as parameter Mar 9, 2017
@ibeex
Copy link
Author

ibeex commented Mar 10, 2017

I was thinking maybe something like in http:https://click.pocoo.org/5/arguments/#file-arguments regarding pipe input.

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

No branches or pull requests

2 participants