MCPcopy Create free account
hub / github.com/cloudfoundry/credhub-cli / Execute

Method Execute

commands/export.go:18–38  ·  view source on GitHub ↗
([]string)

Source from the content-addressed store, hash-verified

16}
17
18func (cmd ExportCommand) Execute([]string) error {
19 allCredentials, err := getAllCredentialsForPath(cmd.Path)
20
21 if err != nil {
22 return err
23 }
24
25 exportCreds, err := models.ExportCredentials(allCredentials, cmd.OutputJSON)
26
27 if err != nil {
28 return err
29 }
30
31 if cmd.File == "" {
32 fmt.Printf("%s", exportCreds)
33
34 return err
35 } else {
36 return os.WriteFile(cmd.File, exportCreds.Bytes, 0644)
37 }
38}
39
40func getAllCredentialsForPath(path string) ([]credentials.Credential, error) {
41 cfg := config.ReadConfig()

Callers

nothing calls this directly

Calls 2

ExportCredentialsFunction · 0.92
getAllCredentialsForPathFunction · 0.85

Tested by

no test coverage detected