-
Notifications
You must be signed in to change notification settings - Fork 210
/
info.go
36 lines (29 loc) · 758 Bytes
/
info.go
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
32
33
34
35
36
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
var infoType string
var defaultInfoType = "AzCopyAppPath"
// initializes the info command, its aliases and description.
func init() {
infoCmd := &cobra.Command{
Use: "info",
Aliases: []string{"info"},
Short: "info gets AzCopy related info.",
Args: func(cmd *cobra.Command, args []string) error {
if len(args) > 1 {
return fmt.Errorf("invalid arguments for info command")
}
infoType = args[0]
return nil
},
Run: func(cmd *cobra.Command, args []string) {
if infoType == defaultInfoType {
fmt.Print(GetAzCopyAppPath())
}
},
}
rootCmd.AddCommand(infoCmd)
infoCmd.PersistentFlags().StringVar(&infoType, "infoType", defaultInfoType, "info to get.")
}