QBitRun/cmd/qbitrun/cli/handle.go

60 lines
2.1 KiB
Go
Raw Permalink Normal View History

2024-06-25 00:19:15 +07:00
package cli
import (
"github.com/spf13/cobra"
"github.com/tigorlazuardi/qbitrun/lib/qbitrun"
)
2024-06-25 00:19:15 +07:00
var handleArgs = qbitrun.RunnerContext{}
2024-06-25 00:19:15 +07:00
var handleCmd = &cobra.Command{
Use: "handle",
Short: "Handles a torrent event from QBittorrent",
Run: func(cmd *cobra.Command, args []string) {
},
}
func init() {
flags := handleCmd.Flags()
flags.BoolVarP(&handleArgs.AddEvent, "add-event", "a", false, "mark this event as add torrent event")
2024-06-25 00:19:15 +07:00
flags.StringVarP(&handleArgs.TorrentName, "torrent-name", "N", "", "Torrent Name")
_ = handleCmd.MarkFlagRequired("torrent-name")
2024-06-25 00:19:15 +07:00
flags.StringVarP(&handleArgs.Category, "category", "L", "", "Category")
_ = handleCmd.MarkFlagRequired("category")
2024-06-25 00:19:15 +07:00
flags.StringSliceVarP(&handleArgs.Tags, "tags", "G", []string{}, "Tags (seperated by comma)")
_ = handleCmd.MarkFlagRequired("tags")
2024-06-25 00:19:15 +07:00
flags.StringVarP(&handleArgs.ContentPath, "content-path", "F", "", "Content Path (same as root path for multifile torrent)")
_ = handleCmd.MarkFlagRequired("content-path")
2024-06-25 00:19:15 +07:00
flags.StringVarP(&handleArgs.RootPath, "root-path", "R", "", "Root path (first torrent subdirectory path)")
_ = handleCmd.MarkFlagRequired("root-path")
2024-06-25 00:19:15 +07:00
flags.StringVarP(&handleArgs.SavePath, "save-path", "D", "", "Save path")
_ = handleCmd.MarkFlagRequired("save-path")
2024-06-25 00:19:15 +07:00
flags.IntVarP(&handleArgs.NumberOfFiles, "number-of-files", "C", 0, "Number of files")
_ = handleCmd.MarkFlagRequired("number-of-files")
2024-06-25 00:19:15 +07:00
flags.Uint64VarP(&handleArgs.TorrentSize, "torrent-size", "Z", 0, "Torrent size")
_ = handleCmd.MarkFlagRequired("torrent-size")
2024-06-25 00:19:15 +07:00
flags.StringVarP(&handleArgs.CurrentTracker, "current-tracker", "T", "", "Current tracker")
_ = handleCmd.MarkFlagRequired("current-tracker")
2024-06-25 00:19:15 +07:00
flags.StringVarP(&handleArgs.InfoHashV1, "info-hash-v1", "I", "", "Info hash v1")
_ = handleCmd.MarkFlagRequired("info-hash-v1")
2024-06-25 00:19:15 +07:00
flags.StringVarP(&handleArgs.InfoHashV2, "info-hash-v2", "J", "", "Info hash v2")
_ = handleCmd.MarkFlagRequired("info-hash-v2")
2024-06-25 00:19:15 +07:00
flags.StringVarP(&handleArgs.TorrentID, "torrent-id", "K", "", "Torrent ID")
_ = handleCmd.MarkFlagRequired("torrent-id")
2024-06-25 00:19:15 +07:00
RootCmd.AddCommand(handleCmd)
}