github.com/paketo-buildpacks/libpak@v1.70.0/cmd/update-build-image-dependency/main.go (about) 1 /* 2 * Copyright 2018-2020 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package main 18 19 import ( 20 "fmt" 21 "log" 22 "os" 23 24 "github.com/spf13/pflag" 25 26 "github.com/paketo-buildpacks/libpak/carton" 27 ) 28 29 func main() { 30 i := carton.BuildImageDependency{} 31 32 flagSet := pflag.NewFlagSet("Update Image Dependency", pflag.ExitOnError) 33 flagSet.StringVar(&i.BuilderPath, "builder-toml", "", "path to builder.toml") 34 flagSet.StringVar(&i.Version, "version", "", "the new version of the dependency") 35 36 if err := flagSet.Parse(os.Args[1:]); err != nil { 37 log.Fatal(fmt.Errorf("unable to parse flags\n%w", err)) 38 } 39 40 if i.BuilderPath == "" { 41 log.Fatal("builder-toml must be set") 42 } 43 44 if i.Version == "" { 45 log.Fatal("version must be set") 46 } 47 48 i.Update() 49 }