github.com/wmuizelaar/kpt@v0.0.0-20221018115725-bd564717b2ed/commands/alpha/license/info/info.go (about) 1 // Copyright 2022 Google LLC 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 info 16 17 import ( 18 "context" 19 "fmt" 20 21 "github.com/GoogleContainerTools/kpt/internal/docs/generated/licensedocs" 22 "github.com/GoogleContainerTools/kpt/licenses" 23 "github.com/spf13/cobra" 24 ) 25 26 func newRunner(ctx context.Context) *runner { 27 r := &runner{ 28 ctx: ctx, 29 } 30 c := &cobra.Command{ 31 Use: "info", 32 Short: licensedocs.InfoShort, 33 Long: licensedocs.InfoShort + "\n" + licensedocs.InfoLong, 34 Example: licensedocs.InfoExamples, 35 RunE: r.runE, 36 } 37 r.Command = c 38 return r 39 } 40 41 func NewCommand(ctx context.Context) *cobra.Command { 42 return newRunner(ctx).Command 43 } 44 45 type runner struct { 46 ctx context.Context 47 Command *cobra.Command 48 } 49 50 func (r *runner) runE(cmd *cobra.Command, args []string) error { 51 fmt.Println(licenses.AllOSSLicense) 52 return nil 53 }