pkg.re/essentialkaos/ek.10@v12.41.0+incompatible/usage/completion/fish/examples_test.go (about)

     1  package fish
     2  
     3  // ////////////////////////////////////////////////////////////////////////////////// //
     4  //                                                                                    //
     5  //                         Copyright (c) 2022 ESSENTIAL KAOS                          //
     6  //      Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>     //
     7  //                                                                                    //
     8  // ////////////////////////////////////////////////////////////////////////////////// //
     9  
    10  import (
    11  	"fmt"
    12  
    13  	"pkg.re/essentialkaos/ek.v12/usage"
    14  )
    15  
    16  // ////////////////////////////////////////////////////////////////////////////////// //
    17  
    18  func ExampleGenerate() {
    19  	info := usage.NewInfo()
    20  
    21  	info.AddCommand("test", "Test data")
    22  	info.AddCommand("clean", "Clean data")
    23  
    24  	info.AddOption("d:dir", "Path to working directory", "dir")
    25  
    26  	info.BoundOptions("test", "d:dir")
    27  	info.BoundOptions("clean", "d:dir")
    28  
    29  	info.AddOption("nc:no-color", "Disable colors in output")
    30  	info.AddOption("h:help", "Show this help message")
    31  	info.AddOption("v:version", "Show version")
    32  
    33  	fmt.Println(Generate(info, "app"))
    34  }