rabbah commented on a change in pull request #2848: Support reading param.json
from stdin #2837
URL:
https://github.com/apache/incubator-openwhisk/pull/2848#discussion_r145533298
##########
File path: docs/actions.md
##########
@@ -202,6 +202,39 @@ Parameters can be passed to the action when it is invoked.
"payload": "Hello, Bernie from Vermont"
}
```
+4. It is possible to pipe JSON parameters to the `wsk` command by using the
special filename `-` with `--params-file` or `-P`:
+
+ ```
+ cat parameters.json | envsubst | wsk action invoke -r hello -P -
+ ```
+
+ This example uses `envsubst` to replace environment variables in the JSON
before passing them to the action invocation.
Review comment:
for the sake of the example is `envsubst` necessary? I can see the counter
argument it's already in a file why use `-`. How about using echo instead?
```bash
echo '{"name": "Alice"}' | wsk action invoke hello -r -P -
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services