File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ package cmd
2
+
3
+ import (
4
+ "fmt"
5
+ "io/ioutil"
6
+ "os"
7
+ "strings"
8
+
9
+ "github.com/spf13/cobra"
10
+ )
11
+
12
+ var (
13
+ lowerCmd = & cobra.Command {
14
+ Use : "lower" ,
15
+ Short : "Convert to lower case" ,
16
+ Run : func (cmd * cobra.Command , args []string ) {
17
+ Verbose (cmd )
18
+ data , err := ioutil .ReadAll (os .Stdin )
19
+ if err != nil {
20
+ panic (err )
21
+ }
22
+ fmt .Println (strings .ToLower (string (data )))
23
+ },
24
+ }
25
+ )
26
+
27
+ func init () {
28
+ rootCmd .AddCommand (lowerCmd )
29
+ }
Original file line number Diff line number Diff line change
1
+ package cmd
2
+
3
+ import (
4
+ "fmt"
5
+ "io/ioutil"
6
+ "os"
7
+ "strings"
8
+
9
+ "github.com/spf13/cobra"
10
+ )
11
+
12
+ var (
13
+ upperCmd = & cobra.Command {
14
+ Use : "upper" ,
15
+ Short : "Convert to UPPER case" ,
16
+ Run : func (cmd * cobra.Command , args []string ) {
17
+ Verbose (cmd )
18
+ data , err := ioutil .ReadAll (os .Stdin )
19
+ if err != nil {
20
+ panic (err )
21
+ }
22
+ fmt .Println (strings .ToUpper (string (data )))
23
+ },
24
+ }
25
+ )
26
+
27
+ func init () {
28
+ rootCmd .AddCommand (upperCmd )
29
+ }
You can’t perform that action at this time.
0 commit comments