vendor/github.com/spf13/cobra/cobra.go
changeset 251 1c52a0eeb952
parent 242 2a9ec03fe5a1
child 256 6d9efbef00a9
equal deleted inserted replaced
250:c040f992052f 251:1c52a0eeb952
    21 	"io"
    21 	"io"
    22 	"reflect"
    22 	"reflect"
    23 	"strconv"
    23 	"strconv"
    24 	"strings"
    24 	"strings"
    25 	"text/template"
    25 	"text/template"
       
    26 	"time"
    26 	"unicode"
    27 	"unicode"
    27 )
    28 )
    28 
    29 
    29 var templateFuncs = template.FuncMap{
    30 var templateFuncs = template.FuncMap{
    30 	"trim":                    strings.TrimSpace,
    31 	"trim":                    strings.TrimSpace,
    53 // Works only on Microsoft Windows.
    54 // Works only on Microsoft Windows.
    54 var MousetrapHelpText string = `This is a command line tool.
    55 var MousetrapHelpText string = `This is a command line tool.
    55 
    56 
    56 You need to open cmd.exe and run it from there.
    57 You need to open cmd.exe and run it from there.
    57 `
    58 `
       
    59 
       
    60 // MousetrapDisplayDuration controls how long the MousetrapHelpText message is displayed on Windows
       
    61 // if the CLI is started from explorer.exe. Set to 0 to wait for the return key to be pressed.
       
    62 // To disable the mousetrap, just set MousetrapHelpText to blank string ("").
       
    63 // Works only on Microsoft Windows.
       
    64 var MousetrapDisplayDuration time.Duration = 5 * time.Second
    58 
    65 
    59 // AddTemplateFunc adds a template function that's available to Usage and Help
    66 // AddTemplateFunc adds a template function that's available to Usage and Help
    60 // template generation.
    67 // template generation.
    61 func AddTemplateFunc(name string, tmplFunc interface{}) {
    68 func AddTemplateFunc(name string, tmplFunc interface{}) {
    62 	templateFuncs[name] = tmplFunc
    69 	templateFuncs[name] = tmplFunc