(c flags.FlagContext)
| 71 | } |
| 72 | |
| 73 | func (cmd *UpdateBuildpack) Execute(c flags.FlagContext) error { |
| 74 | buildpack := cmd.buildpackReq.GetBuildpack() |
| 75 | |
| 76 | cmd.ui.Say(T("Updating buildpack {{.BuildpackName}} with stack {{.BuildpackStack}}...", map[string]interface{}{"BuildpackName": terminal.EntityNameColor(buildpack.Name), "BuildpackStack": terminal.EntityNameColor(buildpack.Stack)})) |
| 77 | |
| 78 | updateBuildpack := false |
| 79 | |
| 80 | if c.IsSet("i") { |
| 81 | position := c.Int("i") |
| 82 | |
| 83 | buildpack.Position = &position |
| 84 | updateBuildpack = true |
| 85 | } |
| 86 | |
| 87 | enabled := c.Bool("enable") |
| 88 | disabled := c.Bool("disable") |
| 89 | if enabled && disabled { |
| 90 | return errors.New(T("Cannot specify both {{.Enabled}} and {{.Disabled}}.", map[string]interface{}{ |
| 91 | "Enabled": "enabled", |
| 92 | "Disabled": "disabled", |
| 93 | })) |
| 94 | } |
| 95 | |
| 96 | if enabled { |
| 97 | buildpack.Enabled = &enabled |
| 98 | updateBuildpack = true |
| 99 | } |
| 100 | if disabled { |
| 101 | disabled = false |
| 102 | buildpack.Enabled = &disabled |
| 103 | updateBuildpack = true |
| 104 | } |
| 105 | |
| 106 | lock := c.Bool("lock") |
| 107 | unlock := c.Bool("unlock") |
| 108 | if lock && unlock { |
| 109 | return errors.New(T("Cannot specify both lock and unlock options.")) |
| 110 | } |
| 111 | |
| 112 | path := c.String("p") |
| 113 | |
| 114 | if path != "" && (lock || unlock) { |
| 115 | return errors.New(T("Cannot specify buildpack bits and lock/unlock.")) |
| 116 | } |
| 117 | |
| 118 | if lock { |
| 119 | buildpack.Locked = &lock |
| 120 | updateBuildpack = true |
| 121 | } |
| 122 | if unlock { |
| 123 | unlock = false |
| 124 | buildpack.Locked = &unlock |
| 125 | updateBuildpack = true |
| 126 | } |
| 127 | var ( |
| 128 | buildpackFile *os.File |
| 129 | buildpackFileName string |
| 130 | err error |
nothing calls this directly
no test coverage detected