Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

simple example

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

package main

import (
	"fmt"

	"github.com/jpillora/opts"
)

type Config struct {
	Foo string
	Bar string
}

func main() {
	c := Config{}
	opts.Parse(&c)
	fmt.Println(c.Foo)
	fmt.Println(c.Bar)
}
``` $ simple --foo hello --bar world ``` ``` plain hello world ``` ``` $ simple --help ``` ``` plain

Usage: simple [options]

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

</tmpl>