Support reading param.json from stdin
- Dominant language
- Go
- Stars
- 109
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
@alexkli commented on [Thu Oct 05 2017](https://github.com/apache/incubator-openwhisk/issues/2837)
It would be useful to support reading a parameter json file from stdin for various piping scenarios, using the convention of "-" as filename:
cat some.json | envsubst | wsk action invoke my-action -P -
In this example we can leverage `envsubst` to replace some environment variables in the file. Without being able to read from stdin, one has to push the content into a temporary file, invoke and then delete the temp file again.
From looking at the go cli code, it seems `readFile()` in [util.go](https://github.com/apache/incubator-openwhisk/blob/26146368f1dd07f817062e662db64c73a8d486d6/tools/cli/go-whisk-cli/commands/util.go#L829) could be adapted to leverage `ioutil.ReadAll(os.Stdin)` in case `filename == "-"`. One probably has to check if that is ok for all other `readFile()` usages, or if that should be a special option reserved for `-P --param-file` only.
---
@alexkli commented on [Tue Oct 10 2017](https://github.com/apache/incubator-openwhisk/issues/2837#issuecomment-335628635)
Provided pull request #2848.
Please have a look, thanks!
Contributor guide
Assessment
This issue has not been assessed yet.