(cmd *cobra.Command, cfg storage, v vcs, profile string)
| 53 | } |
| 54 | |
| 55 | func profileUnapply(cmd *cobra.Command, cfg storage, v vcs, profile string) { |
| 56 | entries, ok := cfg.Lookup(profile) |
| 57 | if !ok { |
| 58 | ui.PrintErrln(cmd, ui.ErrorStyle, "There is no profile with `%s` name", profile) |
| 59 | os.Exit(0) |
| 60 | } |
| 61 | |
| 62 | for _, entry := range entries { |
| 63 | err := v.Unset(entry.Key) |
| 64 | if err != nil { |
| 65 | ui.PrintErrln(cmd, ui.ErrorStyle, "Unable to interact with git to remove current profile: %s", err) |
| 66 | os.Exit(1) |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | err := v.Unset(currentProfileKey) |
| 71 | if err != nil { |
| 72 | ui.PrintErrln(cmd, ui.ErrorStyle, "Unable to interact with git to remove current profile: %s", err) |
| 73 | os.Exit(1) |
| 74 | } |
| 75 | |
| 76 | ui.Println(cmd, ui.SuccessStyle, "Successfully removed `%s` profile from current git repository.", profile) |
| 77 | } |
no test coverage detected