github.com/btwiuse/jiri@v0.0.0-20191125065820-53353bcfef54/cmdline/testdata/nested.go (about)

     1  // Copyright 2015 The Vanadium Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import "github.com/btwiuse/jiri/cmdline"
     8  
     9  // cmdNested represents the nested command.
    10  var cmdNested = &cmdline.Command{
    11  	Name:     "nested",
    12  	Short:    "Short description of command nested",
    13  	Long:     "Long description of command nested.",
    14  	LookPath: true,
    15  	Children: []*cmdline.Command{cmdChild},
    16  }
    17  
    18  // cmdChild represents the child command.
    19  var cmdChild = &cmdline.Command{
    20  	Runner: cmdline.RunnerFunc(runChild),
    21  	Name:   "child",
    22  	Short:  "Short description of command child",
    23  	Long:   "Long description of command child.",
    24  }
    25  
    26  func runChild(env *cmdline.Env, _ []string) error {
    27  	return env.UsageErrorf("wombats!")
    28  }
    29  
    30  func main() {
    31  	cmdline.Main(cmdNested)
    32  }