aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools/emcoctl/cmd/get.go
diff options
context:
space:
mode:
authorRitu Sood <ritu.sood@intel.com>2020-08-29 01:27:53 -0700
committerRitu Sood <ritu.sood@intel.com>2020-09-02 13:59:58 -0700
commitd8ed6e76a40b8942c2b56c623dcc097d734e3dca (patch)
treefe5712061d02d1d971b84cbc2f2f7bca68666cfd /src/tools/emcoctl/cmd/get.go
parentd14246bb9a2c8874f9925c45322d678a93584adb (diff)
Update CLI with complete get implementation
CLI updated with get functionality. Also adding vFw test case Issue-ID: MULTICLOUD-1065 Signed-off-by: Ritu Sood <ritu.sood@intel.com> Change-Id: I7bd22aca9fac9cb7b1f4c93d0ffad5b07b62cced
Diffstat (limited to 'src/tools/emcoctl/cmd/get.go')
-rw-r--r--src/tools/emcoctl/cmd/get.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/tools/emcoctl/cmd/get.go b/src/tools/emcoctl/cmd/get.go
index 2cc96dc4..124ceec7 100644
--- a/src/tools/emcoctl/cmd/get.go
+++ b/src/tools/emcoctl/cmd/get.go
@@ -24,17 +24,24 @@ import (
// getCmd represents the get command
var getCmd = &cobra.Command{
Use: "get",
- Short: "Get the resource(s) based on the URL",
+ Short: "Get the resources from input file or url from command line",
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("get called")
c := NewRestClient()
- if len(args) >= 1 {
- fmt.Println(args[0])
- c.RestClientGet(args[0])
+ if len(inputFiles) > 0 {
+ resources := readResources()
+ c := NewRestClient()
+ for _, res := range resources {
+ c.RestClientGet(res.anchor, res.body)
+ }
+ } else if len(args) >= 1 {
+ c.RestClientGetAnchor(args[0])
+ } else {
+ fmt.Println("Error: No args ")
}
},
}
func init() {
rootCmd.AddCommand(getCmd)
+ getCmd.Flags().StringSliceVarP(&inputFiles, "filename", "f", []string{}, "Filename of the input file")
}