arg

command
v0.0.0-...-8135c48 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2016 License: MIT, MIT Imports: 2 Imported by: 0

README

arg example

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

package main

import (
	"fmt"

	"github.com/jpillora/opts"
)

type Config struct {
	Foo string `type:"arg" help:"foo is a very important argument"`
	Bar string
}

func main() {

	c := Config{}

	opts.New(&c).Parse()

	fmt.Println(c.Foo)
	fmt.Println(c.Bar)
}
``` $ arg --foo hello --bar world ``` ``` plain

Usage: arg [options]

foo is a very important argument

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

Error: flag provided but not defined: -foo

</tmpl>

$ arg --help

<tmpl,code:go run arg.go --help>
``` plain 

  Usage: arg [options] <foo>

  foo is a very important argument

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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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