LoadRepoEnsureUser is the same as LoadRepo, 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)
| 41 | // an identity. Use this pre-run function when an error after using the configured user won't |
| 42 | // do. |
| 43 | func LoadRepoEnsureUser(env *Env) func(*cobra.Command, []string) error { |
| 44 | return func(cmd *cobra.Command, args []string) error { |
| 45 | err := LoadRepo(env)(cmd, args) |
| 46 | if err != nil { |
| 47 | return err |
| 48 | } |
| 49 | |
| 50 | _, err = identity.GetUserIdentity(env.Repo) |
| 51 | if err != nil { |
| 52 | return err |
| 53 | } |
| 54 | |
| 55 | return nil |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | // LoadBackend is a pre-run function that load the repository and the Backend for use in a command |
| 60 | // When using this function you also need to use CloseBackend as a post-run |
nothing calls this directly
no test coverage detected