([]string)
| 16 | } |
| 17 | |
| 18 | func (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 | |
| 40 | func getAllCredentialsForPath(path string) ([]credentials.Credential, error) { |
| 41 | cfg := config.ReadConfig() |
nothing calls this directly
no test coverage detected