...

Source file src/sigs.k8s.io/structured-merge-diff/v4/smd/main.go

Documentation: sigs.k8s.io/structured-merge-diff/v4/smd

     1  /*
     2  Copyright 2018 The Kubernetes 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      http://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 implements a command line tool for performing structured
    18  // operations on yaml files.
    19  package main
    20  
    21  import (
    22  	"flag"
    23  	"log"
    24  
    25  	"sigs.k8s.io/structured-merge-diff/v4/internal/cli"
    26  )
    27  
    28  func main() {
    29  	var o cli.Options
    30  	o.AddFlags(flag.CommandLine)
    31  	flag.Parse()
    32  
    33  	op, err := o.Resolve()
    34  	if err != nil {
    35  		log.Fatalf("Couldn't understand command line flags: %v", err)
    36  	}
    37  
    38  	out, err := o.OpenOutput()
    39  	if err != nil {
    40  		log.Fatalf("Couldn't prepare output: %v", err)
    41  	}
    42  
    43  	err = op.Execute(out)
    44  	if err != nil {
    45  		log.Fatalf("Couldn't execute operation: %v", err)
    46  	}
    47  }
    48  

View as plain text