mirror of
https://github.com/spf13/cobra
synced 2025-07-03 17:47:18 +00:00
doc: add utils 'er' and 'wrStringAndCheck'
This commit is contained in:
parent
e8777b0680
commit
df76712df4
1 changed files with 9 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
||||||
package doc
|
package doc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -49,3 +50,11 @@ type byName []*cobra.Command
|
||||||
func (s byName) Len() int { return len(s) }
|
func (s byName) Len() int { return len(s) }
|
||||||
func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||||
func (s byName) Less(i, j int) bool { return s[i].Name() < s[j].Name() }
|
func (s byName) Less(i, j int) bool { return s[i].Name() < s[j].Name() }
|
||||||
|
|
||||||
|
func er(msg interface{}) {
|
||||||
|
cobra.Er(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
func wrStringAndCheck(b io.StringWriter, s string) {
|
||||||
|
cobra.WrStringAndCheck(b, s)
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue