(cfg storage, v vcs)
| 15 | } |
| 16 | |
| 17 | func unuseCommand(cfg storage, v vcs) *cobra.Command { |
| 18 | return &cobra.Command{ |
| 19 | Use: "unuse [profile]", |
| 20 | Aliases: []string{"uu"}, |
| 21 | Short: "Unuse a profile", |
| 22 | Long: "Removes the applied profile entries from the current git repository.", |
| 23 | Example: multiline( |
| 24 | `git-profile unuse`, |
| 25 | `git-profile unuse my-profile`, |
| 26 | ), |
| 27 | PreRun: func(cmd *cobra.Command, _ []string) { |
| 28 | check(cmd, cfg, v) |
| 29 | }, |
| 30 | Run: func(cmd *cobra.Command, args []string) { |
| 31 | profile, err := unuseProfileResolve(args, v) |
| 32 | if err != nil { |
| 33 | ui.PrintErrln(cmd, ui.ErrorStyle, "%s", err) |
| 34 | os.Exit(0) |
| 35 | } |
| 36 | |
| 37 | profileUnapply(cmd, cfg, v, profile) |
| 38 | }, |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func unuseProfileResolve(args []string, v vcs) (string, error) { |
| 43 | if len(args) > 0 { |
no test coverage detected