neerajmangal edited a comment on issue #430: "wsk property get" should return 
raw output when provided with specific property. 
URL: 
https://github.com/apache/incubator-openwhisk-cli/pull/430#issuecomment-477216702
 
 
   > what about a `--output | -o` flag that takes a single value specifying the 
desired output type?
   > 
   > ```
   > ./wsk property get --namespace -o json   // for future pr :-)
   > ./wsk property get --namespace -o raw
   > ./wsk property get --namespace -o std    // today's formatting
   > ./wsk property get --namespace           // defaults to "std" formatting
   > ```
   > additional output formats can be added without requiring new option flags.
   
   @mdeuser , I attempted an implementation as suggested. 
   
   **New option --output|-o is added to property get command for now with 
std|raw.** 
   ```
   ./wsk property get --help
   get property
   Usage:
     wsk property get [flags]
   
   Flags:
         --all             all properties
         --apibuild        whisk API build version
         --apibuildno      whisk API build number
         --apihost         whisk API host
         --apiversion      whisk API version
         --auth            authorization key
         --cert            client cert
         --cliversion      whisk CLI version
         --key             client key
         --namespace       whisk namespace
     -o, --output string   Output format (default "std")
   
   Global Flags:
     -d, --debug      debug level output
     -i, --insecure   bypass certificate checking
     -v, --verbose    verbose output
   ```
   
   default behavior is "std" if no --output|-o option is provided
   ```
   ./wsk property get
   client cert
   Client key
   whisk auth           23bc46b1-71f6-4ed5-8c54-xxxx
   whisk API host               https://wsk-edge.xxx.com
   whisk API version    v1
   whisk namespace              _
   whisk CLI version    2019-03-27T20:19:17.662+0530
   whisk API build              2018-01-29T18:32:59Z
   whisk API build number       latest
   
   ./wsk property get --all
   client cert
   Client key
   whisk auth           23bc46b1-71f6-4ed5-8c54-xxxx
   whisk API host               https://wsk-edge.xxx.com
   whisk API version    v1
   whisk namespace              _
   whisk CLI version    2019-03-27T20:19:17.662+0530
   whisk API build              2018-01-29T18:32:59Z
   whisk API build number       latest
   
   ./wsk property get --namespace
   whisk namespace              _
   
   ./wsk property get --apihost
   whisk API host               https://wsk-edge.xxxxxx.com
   
   ```
   
   With **raw** Option
   ```
   ./wsk property get --apihost --output raw
   https://wsk-edge.corp.adobe.com
   
   ./wsk property get --namespace --output raw
   _
   
   ```
   
   If "raw" is provided with --all or without property it will return an error. 
   
   ```
   ./wsk property get --output raw
   error: --output|-o raw only supported with specific property type
   
   ./wsk property get --all --output raw
   error: --output|-o raw only supported with specific property type
   ```
   if "std" provided with --all or without a specific property, cmd will treat 
it as default behavior. 
   
   ```
   /wsk property get --all --output std
   client cert
   Client key
   whisk auth           23bc46b1-71f6-4ed5-8c54-xxxxx
   whisk API host               https://wsk-edge.xxxx.com
   whisk API version    v1
   whisk namespace              _
   whisk CLI version    2019-03-27T20:19:17.662+0530
   whisk API build              2018-01-29T18:32:59Z
   whisk API build number       latest
   ```
   I am writing test cases for new output flag and also will update the 
documentation. 
   Let me know your feedback. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to