-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.go
36 lines (26 loc) · 976 Bytes
/
table.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 (
"runtime"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var (
tableName string
numWorkers int
)
// tableCmd represents the table command
var tableCmd = &cobra.Command{
Use: "table",
Short: "Commands for Azure Storage Table purge",
Long: `Commands for Azure Storage Table purge`,
}
func init() {
rootCmd.AddCommand(tableCmd)
tableCmd.PersistentFlags().String("account-name", "", "The storage account name")
viper.BindPFlag("account-name", tableCmd.PersistentFlags().Lookup("account-name"))
tableCmd.PersistentFlags().String("account-key", "", "The storage account key")
viper.BindPFlag("account-key", tableCmd.PersistentFlags().Lookup("account-key"))
tableCmd.PersistentFlags().StringVar(&tableName, "table-name", "", "The storage table name")
tableCmd.MarkPersistentFlagRequired("table-name")
tableCmd.PersistentFlags().IntVar(&numWorkers, "num-workers", runtime.NumCPU()*4, "Number of workers. Default is cpus * 4")
}