customhelp

command
Version: v0.0.0-...-fdaaeef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2016 License: MIT, MIT Imports: 2 Imported by: 0

README

custom help example

<tmpl,code=go:cat customhelp.go>

package main

import (
	"fmt"

	"github.com/jpillora/opts"
)

type Config struct {
	Foo string
	Bar string
}

func main() {

	c := Config{}

	//see default templates and the default template order
	//in the opts/help.go file
	o := opts.New(&c).
		DocAfter("usage", "mytext", "\nthis is a some text!\n"). //add new entry
		Repo("myfoo.com/bar").
		DocSet("repo", "\nMy awesome repo:\n  {{.Repo}}"). //change existing entry
		Parse()

	fmt.Println(o.Help())
}
$ customhelp --help

<tmpl,code:go run customhelp.go --help>


  Usage: customhelp [options]

  this is a some text!

  Options:
  --foo, -f
  --bar, -b
  --help, -h

  My awesome repo:
    myfoo.com/bar

Documentation

The Go Gopher

There is no documentation for this package.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL