excel-export/cmd/cmd/root.go

29 lines
723 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package cmd
import (
"github.com/spf13/cobra"
"os"
)
var rootCmd = &cobra.Command{
Use: "export",
Short: "导出直充系统订单数据",
SilenceUsage: true,
SilenceErrors: true,
}
func Execute() {
path, _ := os.Getwd()
rootCmd.PersistentFlags().StringP("path", "p", path, "文件路径")
rootCmd.PersistentFlags().IntP("query", "q", 10000, "单次查询数")
rootCmd.PersistentFlags().IntP("limit", "l", 1000000, "单个文档最大记录数")
OrderCmd.Flags().StringP("begin", "b", "", "开始时间2006-01-02 15:04:05")
OrderCmd.Flags().StringP("end", "e", "", "结束时间2006-01-02 15:04:05")
rootCmd.AddCommand(OrderCmd)
cobra.CheckErr(rootCmd.Execute())
}