1 // Copyright 2018 Google LLC All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package main 16 17 import ( 18 "context" 19 "os" 20 "os/signal" 21 22 "github.com/google/go-containerregistry/cmd/crane/cmd" 23 "github.com/google/go-containerregistry/pkg/logs" 24 ) 25 26 func init() { 27 logs.Warn.SetOutput(os.Stderr) 28 logs.Progress.SetOutput(os.Stderr) 29 } 30 31 func main() { 32 ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) 33 defer cancel() 34 if err := cmd.Root.ExecuteContext(ctx); err != nil { 35 cancel() 36 os.Exit(1) 37 } 38 } 39