refactor: rename command to :set-property

This will allow us to set other property values for the buildpacks plugin.
This commit is contained in:
Jose Diaz-Gonzalez
2021-01-23 18:17:40 -05:00
parent 5d9157bc40
commit f81c802ecc
9 changed files with 42 additions and 36 deletions

View File

@@ -24,7 +24,7 @@ Additional commands:`
buildpacks:remove <app> <buildpack>, Remove a buildpack set on the app
buildpacks:report [<app>] [<flag>], Displays a buildpack report for one or more apps
buildpacks:set [--index 1] <app> <buildpack>, Set new app buildpack at a given position defaulting to the first buildpack if no index is specified
buildpacks:stack-set <app> <stack>, Sets the stack of an app
buildpacks:set-property [--global|<app>] <key> <value>, Set or clear a buildpacks property for an app
`
)

View File

@@ -57,17 +57,19 @@ func main() {
appName := args.Arg(0)
buildpack := args.Arg(1)
err = buildpacks.CommandSet(appName, buildpack, *index)
case "stack-set":
args := flag.NewFlagSet("buildpacks:stack-set", flag.ExitOnError)
case "set-property":
args := flag.NewFlagSet("buildpacks:set-property", flag.ExitOnError)
global := args.Bool("global", false, "--global: set a global property")
args.Parse(os.Args[2:])
appName := args.Arg(0)
stack := args.Arg(1)
property := args.Arg(1)
value := args.Arg(2)
if *global {
appName = "--global"
stack = args.Arg(0)
property = args.Arg(0)
value = args.Arg(1)
}
err = buildpacks.CommandStackSet(appName, stack)
err = buildpacks.CommandSetProperty(appName, property, value)
default:
common.LogFail(fmt.Sprintf("Invalid plugin subcommand call: %s", subcommand))
}