LoadBackendEnsureUser is the same as LoadBackend, but also ensure that the user has configured an identity. Use this pre-run function when an error after using the configured user won't do.
(env *Env)
| 94 | // an identity. Use this pre-run function when an error after using the configured user won't |
| 95 | // do. |
| 96 | func LoadBackendEnsureUser(env *Env) func(*cobra.Command, []string) error { |
| 97 | return func(cmd *cobra.Command, args []string) error { |
| 98 | err := LoadBackend(env)(cmd, args) |
| 99 | if err != nil { |
| 100 | return err |
| 101 | } |
| 102 | |
| 103 | _, err = identity.GetUserIdentity(env.Repo) |
| 104 | if err != nil { |
| 105 | return err |
| 106 | } |
| 107 | |
| 108 | return nil |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | // CloseBackend is a wrapper for a RunE function that will close the Backend properly |
| 113 | // if it has been opened. |
no test coverage detected