...

Source file src/github.com/google/go-containerregistry/cmd/crane/help/main.go

Documentation: github.com/google/go-containerregistry/cmd/crane/help

     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  	"fmt"
    19  	"os"
    20  
    21  	"github.com/google/go-containerregistry/cmd/crane/cmd"
    22  	"github.com/spf13/cobra"
    23  	"github.com/spf13/cobra/doc"
    24  )
    25  
    26  var dir string
    27  var root = &cobra.Command{
    28  	Use:   "gendoc",
    29  	Short: "Generate crane's help docs",
    30  	Args:  cobra.NoArgs,
    31  	RunE: func(*cobra.Command, []string) error {
    32  		return doc.GenMarkdownTree(cmd.Root, dir)
    33  	},
    34  }
    35  
    36  func init() {
    37  	root.Flags().StringVarP(&dir, "dir", "d", ".", "Path to directory in which to generate docs")
    38  }
    39  
    40  func main() {
    41  	if err := root.Execute(); err != nil {
    42  		fmt.Println(err)
    43  		os.Exit(1)
    44  	}
    45  }
    46  

View as plain text