2016-01-01 21:12:40 +00:00
. \" generated with Ronn/v0.7.3
. \" http://github.com/rtomayko/ronn/tree/0.7.3
.
2016-02-07 11:06:04 +00:00
.TH "GETOPTS" "1" "February 2016" "" "fisherman"
2016-01-01 21:12:40 +00:00
.
.SH "NAME"
2016-02-27 06:27:17 +00:00
\fB getopts\fR \- Command line options parser
2016-01-01 21:12:40 +00:00
.
.SH "SYNOPSIS"
2016-02-27 06:27:17 +00:00
getopts \fI options\fR \. \. \.
2016-01-01 21:12:40 +00:00
.
.br
.
.SH "DESCRIPTION"
2016-02-20 13:19:25 +00:00
\fB Getopts\fR is a command line options parser for fish\.
2016-01-01 21:12:40 +00:00
.
.SH "USAGE"
2016-02-27 06:27:17 +00:00
Study the output of the following example
2016-01-01 21:12:40 +00:00
.
.IP "" 4
.
.nf
getopts \- ab1 \- \- foo=bar baz
.
.fi
.
.IP "" 0
.
.IP "" 4
.
.nf
a
b 1
foo bar
_ baz
.
.fi
.
.IP "" 0
.
.P
2016-02-27 06:27:17 +00:00
The items on the left are the option flags\. The items on the right are the option values\. The underscore \fB _\fR character is the default \fI key\fR for bare arguments\.
2016-01-01 21:12:40 +00:00
.
.P
2016-02-27 06:27:17 +00:00
Use read(1) to process the generated stream and switch(1) to match patterns
2016-01-01 21:12:40 +00:00
.
.IP "" 4
.
.nf
getopts \- ab1 \- \- foo=bar baz | while read \- l key option
switch $key
case _
case a
case b
case foo
end
end
.
.fi
.
.IP "" 0
.
2016-02-20 13:19:25 +00:00
.SH "NOTES"
2016-01-01 21:12:40 +00:00
.
.IP "\(bu" 4
A double dash, \fB \- \- \fR , marks the end of options\. Arguments after this sequence are placed in the default underscore key, \fB _\fR \.
.
.IP "" 0
2016-02-27 06:27:17 +00:00