mirror of
https://github.com/bit1001/tdl.git
synced 2024-11-10 08:26:07 +08:00
34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package up
|
|
|
|
import (
|
|
"github.com/iyear/tdl/app/up"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
partSize int
|
|
threads int
|
|
limit int
|
|
|
|
paths []string
|
|
excludes []string
|
|
)
|
|
|
|
var Cmd = &cobra.Command{
|
|
Use: "up",
|
|
Aliases: []string{"upload"},
|
|
Short: "Upload anything to Telegram",
|
|
Example: "tdl up -n iyear --proxy socks5://localhost:1080 -p /path/to/file -p /path -e .so -e .tmp -s 262144 -t 16 -l 3",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
return up.Run(cmd.Context(), cmd.Flag("ns").Value.String(), cmd.Flag("proxy").Value.String(), partSize, threads, limit, paths, excludes)
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
Cmd.PersistentFlags().IntVarP(&partSize, "part-size", "s", 512*1024, "part size for uploading, max is 512*1024")
|
|
Cmd.PersistentFlags().IntVarP(&threads, "threads", "t", 8, "threads for uploading one item")
|
|
Cmd.PersistentFlags().IntVarP(&limit, "limit", "l", 2, "max number of concurrent tasks")
|
|
|
|
Cmd.Flags().StringSliceVarP(&paths, "path", "p", []string{}, "dirs or files")
|
|
Cmd.Flags().StringSliceVarP(&excludes, "excludes", "e", []string{}, "exclude the specified file extensions")
|
|
}
|