summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2015-11-15 11:01:00 +1030
committerAlex Flint <[email protected]>2015-11-15 11:01:00 +1030
commit785fa3f8c93bc43540b189bacaed9d9aba890528 (patch)
treeda91cce4d42851340a76d056f0df831a4109a023
parentc4704194de65e09b88ebae2f2c81ee4e0a3be5d8 (diff)
parentab43eae565dcc5aefbd03cf0bbe1fb8ce5692290 (diff)
Merge pull request #16 from walle/move_doc
Move package documentation to doc.go
-rw-r--r--doc.go36
-rw-r--r--parse.go35
2 files changed, 36 insertions, 35 deletions
diff --git a/doc.go b/doc.go
new file mode 100644
index 0000000..500ec83
--- /dev/null
+++ b/doc.go
@@ -0,0 +1,36 @@
+// Package arg parses command line arguments using the fields from a struct.
+//
+// For example,
+//
+// var args struct {
+// Iter int
+// Debug bool
+// }
+// arg.MustParse(&args)
+//
+// defines two command line arguments, which can be set using any of
+//
+// ./example --iter=1 --debug // debug is a boolean flag so its value is set to true
+// ./example -iter 1 // debug defaults to its zero value (false)
+// ./example --debug=true // iter defaults to its zero value (zero)
+//
+// The fastest way to see how to use go-arg is to read the examples below.
+//
+// Fields can be bool, string, any float type, or any signed or unsigned integer type.
+// They can also be slices of any of the above, or slices of pointers to any of the above.
+//
+// Tags can be specified using the `arg` package name:
+//
+// var args struct {
+// Input string `arg:"positional"`
+// Log string `arg:"positional,required"`
+// Debug bool `arg:"-d,help:turn on debug mode"`
+// RealMode bool `arg:"--real"
+// Wr io.Writer `arg:"-"`
+// }
+//
+// The valid tag strings are `positional`, `required`, and `help`. Further, any tag string
+// that starts with a single hyphen is the short form for an argument (e.g. `./example -d`),
+// and any tag string that starts with two hyphens is the long form for the argument
+// (instead of the field name). Fields can be excluded from processing with `arg:"-"`.
+package arg
diff --git a/parse.go b/parse.go
index 923e749..a9e509f 100644
--- a/parse.go
+++ b/parse.go
@@ -1,38 +1,3 @@
-// Package arg parses command line arguments using the fields from a struct.
-//
-// For example,
-//
-// var args struct {
-// Iter int
-// Debug bool
-// }
-// arg.MustParse(&args)
-//
-// defines two command line arguments, which can be set using any of
-//
-// ./example --iter=1 --debug // debug is a boolean flag so its value is set to true
-// ./example -iter 1 // debug defaults to its zero value (false)
-// ./example --debug=true // iter defaults to its zero value (zero)
-//
-// The fastest way to see how to use go-arg is to read the examples below.
-//
-// Fields can be bool, string, any float type, or any signed or unsigned integer type.
-// They can also be slices of any of the above, or slices of pointers to any of the above.
-//
-// Tags can be specified using the `arg` package name:
-//
-// var args struct {
-// Input string `arg:"positional"`
-// Log string `arg:"positional,required"`
-// Debug bool `arg:"-d,help:turn on debug mode"`
-// RealMode bool `arg:"--real"
-// Wr io.Writer `arg:"-"`
-// }
-//
-// The valid tag strings are `positional`, `required`, and `help`. Further, any tag string
-// that starts with a single hyphen is the short form for an argument (e.g. `./example -d`),
-// and any tag string that starts with two hyphens is the long form for the argument
-// (instead of the field name). Fields can be excluded from processing with `arg:"-"`.
package arg
import (