package cli import ( "github.com/spf13/cobra" "github.com/tigorlazuardi/qbitrun/lib/qbitrun" ) var handleArgs = qbitrun.RunnerContext{} 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") flags.StringVarP(&handleArgs.TorrentName, "torrent-name", "N", "", "Torrent Name") _ = handleCmd.MarkFlagRequired("torrent-name") flags.StringVarP(&handleArgs.Category, "category", "L", "", "Category") _ = handleCmd.MarkFlagRequired("category") flags.StringSliceVarP(&handleArgs.Tags, "tags", "G", []string{}, "Tags (seperated by comma)") _ = handleCmd.MarkFlagRequired("tags") flags.StringVarP(&handleArgs.ContentPath, "content-path", "F", "", "Content Path (same as root path for multifile torrent)") _ = handleCmd.MarkFlagRequired("content-path") flags.StringVarP(&handleArgs.RootPath, "root-path", "R", "", "Root path (first torrent subdirectory path)") _ = handleCmd.MarkFlagRequired("root-path") flags.StringVarP(&handleArgs.SavePath, "save-path", "D", "", "Save path") _ = handleCmd.MarkFlagRequired("save-path") flags.IntVarP(&handleArgs.NumberOfFiles, "number-of-files", "C", 0, "Number of files") _ = handleCmd.MarkFlagRequired("number-of-files") flags.Uint64VarP(&handleArgs.TorrentSize, "torrent-size", "Z", 0, "Torrent size") _ = handleCmd.MarkFlagRequired("torrent-size") flags.StringVarP(&handleArgs.CurrentTracker, "current-tracker", "T", "", "Current tracker") _ = handleCmd.MarkFlagRequired("current-tracker") flags.StringVarP(&handleArgs.InfoHashV1, "info-hash-v1", "I", "", "Info hash v1") _ = handleCmd.MarkFlagRequired("info-hash-v1") flags.StringVarP(&handleArgs.InfoHashV2, "info-hash-v2", "J", "", "Info hash v2") _ = handleCmd.MarkFlagRequired("info-hash-v2") flags.StringVarP(&handleArgs.TorrentID, "torrent-id", "K", "", "Torrent ID") _ = handleCmd.MarkFlagRequired("torrent-id") RootCmd.AddCommand(handleCmd) }