apache / apache/openwhisk-cli

Support reading param.json from stdin

Open
#126 1 comment 0 reactions 1 assignee Claimed by @rabbah View on GitHub
enhancement
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.