Skip to content

Commit ecf9ad2

Browse files
committed
comment: modified some documentation comments
1 parent 784cf51 commit ecf9ad2

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

doc.go

-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ like `optcfg:"name="`.
235235
// This is description of baz.
236236
// --qux This is description of qux.
237237
238-
239238
## Parse command line arguments including sub command
240239
241240
This module provides methods Cmd#parseUntilSubCmd, Cmd#parseUntilSubCmdWith, and

parse-with.go

+18-10
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,32 @@ import (
1111
const anyOption = "*"
1212

1313
// ParseWith is the method which parses command line arguments with option configurations.
14-
// This function divides command line arguments to command arguments and options.
14+
// This method divides command line arguments to command arguments and options.
15+
//
1516
// And an option consists of a name and an option argument.
1617
// Options are separated to long format options and short format options.
17-
// About long/short format options, since they are same with Parse function, see the comment of
18-
// that function.
18+
// About long/short format options, since they are same with Parse method, see the comment of
19+
// that method.
20+
//
21+
// This method allows only options declared in option configurations, basically.
22+
// An option configuration has fields: StoreKey, Names, HasArg, IsArray, Defaults, Desc,
23+
// ArgInHelp, and Validator.
1924
//
20-
// This function allows only options declared in option configurations.
21-
// An option configuration has fields: StoreKey, Names, HasArg, IsArray, Defaults, Desc and
22-
// ArgInHelp.
23-
// When an option matches one of the Names in an option configuration, the option is registered
25+
// When an option matches one of the Names in the option configurations, the option is registered
2426
// into Cmd with StoreKey.
25-
// If both HasArg and IsArray are true, the option can have one or multiple option argumentsr, and
27+
// If both HasArg and IsArray are true, the option can have one or multiple option arguments, and
2628
// if HasArg is true and IsArray is false, the option can have only one option argument, otherwise
2729
// the option cannot have option arguments.
2830
// If Defaults field is specified and no option value is given in command line arguments, the value
2931
// of Defaults is set as the option arguments.
3032
//
31-
// If options not declared in option configurationsi are given in command line arguments, this
32-
// function basically returns UnconfiguradOption error.
33+
// If options not declared in option configurations are given in command line arguments, this
34+
// method basically returns UnconfiguradOption error.
3335
// However, if you want to allow other options, add an option configuration of which StoreKey or
3436
// the first element of Names is "*".
37+
//
38+
// The option configurations used to parsing are set into this Cmd instance, and it can be
39+
// retrieved from its field: Cmd#OptCfgs.
3540
func (cmd *Cmd) ParseWith(optCfgs []OptCfg) error {
3641
_, err := cmd.parseArgsWith(optCfgs, false)
3742
cmd.OptCfgs = optCfgs
@@ -46,6 +51,9 @@ func (cmd *Cmd) ParseWith(optCfgs []OptCfg) error {
4651
//
4752
// This method parses command line arguments in the same way as the Cmd#parse_with method,
4853
// except that it only parses the command line arguments before the first command argument.
54+
//
55+
// The option configurations used to parsing are set into this Cmd instance, and it can be
56+
// retrieved from its field: Cmd#OptCfgs.
4957
func (cmd *Cmd) ParseUntilSubCmdWith(optCfgs []OptCfg) (Cmd, error) {
5058
idx, err := cmd.parseArgsWith(optCfgs, true)
5159
cmd.OptCfgs = optCfgs

0 commit comments

Comments
 (0)