Skip to content

Commit

Permalink
Adjust to limitations of Go's cross-reference markdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobg committed Aug 9, 2023
1 parent d68c4a2 commit 9489753
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (e *MissingSubcmdErr) Error() string {
return fmt.Sprintf("missing subcommand, want one of: %s", strings.Join(subcmdNames(e.cmd), "; "))
}

// Detail implements [Usage].
// Detail implements Usage.
func (e *MissingSubcmdErr) Detail() string {
return missingUnknownSubcmd("Missing subcommand, want one of:", e.cmd)
}
Expand Down Expand Up @@ -99,7 +99,7 @@ func (e *HelpRequestedErr) Error() string {
return fmt.Sprintf("subcommands are: %s", strings.Join(subcmdNames(e.cmd), "; "))
}

// Detail implements [Usage].
// Detail implements Usage.
func (e *HelpRequestedErr) Detail() string {
if e.name != "" {
// foo bar help baz
Expand Down Expand Up @@ -193,7 +193,7 @@ func (e *UnknownSubcmdErr) Error() string {
return fmt.Sprintf(`unknown subcommand "%s", want one of: %s`, e.name, strings.Join(subcmdNames(e.cmd), "; "))
}

// Detail implements [Usage].
// Detail implements Usage.
func (e *UnknownSubcmdErr) Detail() string {
return missingUnknownSubcmd(fmt.Sprintf(`Unknown subcommand "%s", want one of:`, e.name), e.cmd)
}
Expand Down
2 changes: 1 addition & 1 deletion parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func parseValuePos(args *[]string, argvals *[]reflect.Value, p Param) error {
//
// - a [flag.FlagSet],
// - a list of properly typed pointers (or in the case of a [Value]-typed Param, a [flag.Value]) in which to store the results of calling Parse on the FlagSet,
// - a list of positional [Param]s that are not part of the resulting FlagSet.
// - a list of positional Params that are not part of the resulting FlagSet.
//
// On a successful return, len(ptrs)+len(positional) == len(params).
func ToFlagSet(params []Param) (fs *flag.FlagSet, ptrs []reflect.Value, positional []Param, err error) {
Expand Down
6 changes: 3 additions & 3 deletions subcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type Prefixer interface {
Prefix() string
}

// Map is the type of the data structure returned by [Cmd.Subcmds] and by [Commands].
// Map is the type of the data structure returned by Cmd.Subcmds and by [Commands].
// It maps a subcommand name to its [Subcmd] structure.
type Map = map[string]Subcmd

Expand All @@ -61,7 +61,7 @@ func subcmdNames(c Cmd) []string {
}

// Subcmd is one subcommand of a [Cmd],
// and the value type in the [Map] returned by [Cmd.Subcmds].
// and the value type in the [Map] returned by Cmd.Subcmds.
//
// The function [Check] can be used to check that the type of the F field
// is a function with parameters matching those specified by the Params field,
Expand Down Expand Up @@ -180,7 +180,7 @@ func (t Type) reflectType() reflect.Type {
}

// Commands is a convenience function for producing the [Map]
// needed by an implementation of [Cmd.Subcmd].
// needed by an implementation of Cmd.Subcmd.
// It takes arguments in groups of two or four,
// one group per subcommand.
//
Expand Down

0 comments on commit 9489753

Please sign in to comment.