fix examples

This commit is contained in:
Alex Flint 2015-11-01 13:36:14 -08:00
parent 3ff6f256dc
commit 8b5a16fafe
1 changed files with 6 additions and 8 deletions

View File

@ -3,8 +3,6 @@ package arg
import ( import (
"fmt" "fmt"
"os" "os"
"github.com/alexflint/go-arg"
) )
// This example demonstrates basic usage // This example demonstrates basic usage
@ -16,7 +14,7 @@ func Example_Basic() {
Foo string Foo string
Bar bool Bar bool
} }
arg.MustParse(&args) MustParse(&args)
fmt.Println(args.Foo, args.Bar) fmt.Println(args.Foo, args.Bar)
} }
@ -30,7 +28,7 @@ func Example_DefaultValues() {
Bar bool Bar bool
} }
args.Foo = "default value" args.Foo = "default value"
arg.MustParse(&args) MustParse(&args)
fmt.Println(args.Foo, args.Bar) fmt.Println(args.Foo, args.Bar)
} }
@ -43,7 +41,7 @@ func Example_RequiredArguments() {
Foo string `arg:"required"` Foo string `arg:"required"`
Bar bool Bar bool
} }
arg.MustParse(&args) MustParse(&args)
} }
// This example demonstrates positional arguments // This example demonstrates positional arguments
@ -55,7 +53,7 @@ func Example_PositionalArguments() {
Input string `arg:"positional"` Input string `arg:"positional"`
Output []string `arg:"positional"` Output []string `arg:"positional"`
} }
arg.MustParse(&args) MustParse(&args)
fmt.Println("Input:", args.Input) fmt.Println("Input:", args.Input)
fmt.Println("Output:", args.Output) fmt.Println("Output:", args.Output)
} }
@ -69,7 +67,7 @@ func Example_MultipleValues() {
Database string Database string
IDs []int64 IDs []int64
} }
arg.MustParse(&args) MustParse(&args)
fmt.Printf("Fetching the following IDs from %s: %q", args.Database, args.IDs) fmt.Printf("Fetching the following IDs from %s: %q", args.Database, args.IDs)
} }
@ -85,5 +83,5 @@ func Example_UsageString() {
Dataset string `arg:"help:dataset to use"` Dataset string `arg:"help:dataset to use"`
Optimize int `arg:"-O,help:optimization level"` Optimize int `arg:"-O,help:optimization level"`
} }
arg.MustParse(&args) MustParse(&args)
} }