mirror of
https://github.com/golang/go
synced 2024-11-20 09:34:52 -07:00
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>
This commit is contained in:
parent
2ae77376f7
commit
4735002f58
@ -513,7 +513,8 @@ func (f *FlagSet) NFlag() int { return len(f.actual) }
|
|||||||
func NFlag() int { return len(CommandLine.actual) }
|
func NFlag() int { return len(CommandLine.actual) }
|
||||||
|
|
||||||
// Arg returns the i'th argument. Arg(0) is the first remaining argument
|
// 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 {
|
func (f *FlagSet) Arg(i int) string {
|
||||||
if i < 0 || i >= len(f.args) {
|
if i < 0 || i >= len(f.args) {
|
||||||
return ""
|
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
|
// 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 {
|
func Arg(i int) string {
|
||||||
return CommandLine.Arg(i)
|
return CommandLine.Arg(i)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user