feat: arr and map methods now output json to make the read, mutate, write loop easier.
This commit is contained in:
1 parent
aa3d497139
commit
1892fd9e8a
2 files changed
+12
-2
No files matched your search
@@ -1,6 +1,7 @@
|
|||||||
package hmsecrets
|
package hmsecrets
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -20,7 +21,11 @@ var getArrCmd = &cobra.Command{
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println(secret)
|
secretJSON, err := json.MarshalIndent(secret, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Println(string(secretJSON))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package hmsecrets
|
package hmsecrets
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -20,7 +21,11 @@ var getMapCmd = &cobra.Command{
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println(secret)
|
secretJSON, err := json.MarshalIndent(secret, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Println(string(secretJSON))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user