blob: 23692fafad4dd03894a402af5ee3313d4d2ef39f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package opts
import "fmt"
// A BadOptionError describes an option that the user attempted to pass
// which the developer did not register.
type BadOptionError struct {
r rune
s string
}
func (e BadOptionError) Error() string {
if e.r != 0 {
return fmt.Sprintf("unknown option ‘-%c’", e.r)
}
return fmt.Sprintf("unknown option ‘--%s’", e.s)
}
// A NoArgumentError describes an option that the user attempted to pass
// without an argument, which required an argument.
type NoArgumentError struct {
r rune
s string
}
func (e NoArgumentError) Error() string {
if e.r != 0 {
return fmt.Sprintf("expected argument for option ‘-%c’", e.r)
}
return fmt.Sprintf("expected argument for option ‘--%s’", e.s)
}
|