diff options
author | Hariharan Srinath <srinathh@gmail.com> | 2015-07-11 14:20:14 +0530 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2015-07-12 03:22:26 +0000 |
commit | 4735002f58af2cf7f8ffbbea1830fe0401579102 (patch) | |
tree | 85389f68018ed902d7ec203c0858c617d3595704 /src/flag | |
parent | 2ae77376f7ab6f4161944570cb1b3a38ff47c5cd (diff) | |
download | go-4735002f58af2cf7f8ffbbea1830fe0401579102.tar.gz go-4735002f58af2cf7f8ffbbea1830fe0401579102.zip |
flag: Clarifies docs for Arg(int) and FlagSet.Arg(int)
Adds the clarification that these functions return empty
string if the requested element is not available
Added fullstops
Fixes #11664
Change-Id: I84173862bc785240f7d3ee75a5023673264d172b
Reviewed-on: https://go-review.googlesource.com/12061
Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/flag')
-rw-r--r-- | src/flag/flag.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/flag/flag.go b/src/flag/flag.go index d1cb0a5ae6..cf6af4e946 100644 --- a/src/flag/flag.go +++ b/src/flag/flag.go @@ -513,7 +513,8 @@ func (f *FlagSet) NFlag() int { return len(f.actual) } func NFlag() int { return len(CommandLine.actual) } // Arg returns the i'th argument. Arg(0) is the first remaining argument -// after flags have been processed. +// after flags have been processed. Arg returns an empty string if the +// requested element does not exist. func (f *FlagSet) Arg(i int) string { if i < 0 || i >= len(f.args) { return "" @@ -522,7 +523,8 @@ func (f *FlagSet) Arg(i int) string { } // Arg returns the i'th command-line argument. Arg(0) is the first remaining argument -// after flags have been processed. +// after flags have been processed. Arg returns an empty string if the +// requested element does not exist. func Arg(i int) string { return CommandLine.Arg(i) } |