49 |
49 |
50 listsCmd.PersistentFlags().UintVarP(&listsOpts.limit, "limit", "l", 0, "Limit number of API results") |
50 listsCmd.PersistentFlags().UintVarP(&listsOpts.limit, "limit", "l", 0, "Limit number of API results") |
51 listsCmd.PersistentFlags().UintVarP(&listsOpts.keep, "keep", "k", 0, "Limit number of results") |
51 listsCmd.PersistentFlags().UintVarP(&listsOpts.keep, "keep", "k", 0, "Limit number of results") |
52 listsCmd.PersistentFlags().BoolVar(&listsOpts.all, "all", false, "Fetch all results") |
52 listsCmd.PersistentFlags().BoolVar(&listsOpts.all, "all", false, "Fetch all results") |
53 |
53 |
54 listsCmd.PersistentFlags().Int64VarP(&listsOpts.listID, "list-id", "G", 0, "List ID") |
54 listsCmd.PersistentFlags().StringVarP(&listsOpts.listID, "list-id", "G", "", "List ID") |
55 |
55 |
56 listsGetSubcommand.Flags().Int64VarP(&listsOpts.accountID, "account-id", "a", 0, "Account ID number") |
56 listsGetSubcommand.Flags().StringVarP(&listsOpts.accountID, "account-id", "a", "", "Account ID number") |
57 // XXX accountUID? |
57 // XXX accountUID? |
58 |
58 |
59 listsGetAccountsSubcommand.Flags().Int64VarP(&listsOpts.listID, "list-id", "G", 0, "List ID") |
59 listsGetAccountsSubcommand.Flags().StringVarP(&listsOpts.listID, "list-id", "G", "", "List ID") |
60 |
60 |
61 listsCreateSubcommand.Flags().StringVar(&listsOpts.title, "title", "", "List title") |
61 listsCreateSubcommand.Flags().StringVar(&listsOpts.title, "title", "", "List title") |
62 listsUpdateSubcommand.Flags().StringVar(&listsOpts.title, "title", "", "List title") |
62 listsUpdateSubcommand.Flags().StringVar(&listsOpts.title, "title", "", "List title") |
63 |
63 |
64 listsAddAccountsSubcommand.Flags().StringVar(&listsOpts.accountIDs, "account-ids", "", "Comma-separated list of account IDs") |
64 listsAddAccountsSubcommand.Flags().StringVar(&listsOpts.accountIDs, "account-ids", "", "Comma-separated list of account IDs") |
65 listsAddAccountsSubcommand.Flags().Int64VarP(&listsOpts.accountID, "account-id", "a", 0, "Account ID number") |
65 listsAddAccountsSubcommand.Flags().StringVarP(&listsOpts.accountID, "account-id", "a", "", "Account ID number") |
66 listsRemoveAccountsSubcommand.Flags().StringVar(&listsOpts.accountIDs, "account-ids", "", "Comma-separated list of account IDs") |
66 listsRemoveAccountsSubcommand.Flags().StringVar(&listsOpts.accountIDs, "account-ids", "", "Comma-separated list of account IDs") |
67 listsRemoveAccountsSubcommand.Flags().Int64VarP(&listsOpts.accountID, "account-id", "a", 0, "Account ID number") |
67 listsRemoveAccountsSubcommand.Flags().StringVarP(&listsOpts.accountID, "account-id", "a", "", "Account ID number") |
68 } |
68 } |
69 |
69 |
70 var listsSubcommands = []*cobra.Command{ |
70 var listsSubcommands = []*cobra.Command{ |
71 listsGetSubcommand, |
71 listsGetSubcommand, |
72 listsCreateSubcommand, |
72 listsCreateSubcommand, |
298 } |
298 } |
299 |
299 |
300 func listsAddRemoveAccountsRunE(cmd *cobra.Command, args []string) error { |
300 func listsAddRemoveAccountsRunE(cmd *cobra.Command, args []string) error { |
301 opt := listsOpts |
301 opt := listsOpts |
302 |
302 |
303 if opt.listID <= 0 { |
303 if opt.listID == "" { |
304 return errors.New("missing list ID") |
304 return errors.New("missing list ID") |
305 } |
305 } |
306 |
306 |
307 var ids []int64 |
307 var ids []madon.ActivityID |
308 var err error |
308 var err error |
309 ids, err = splitIDs(opt.accountIDs) |
309 ids, err = splitIDs(opt.accountIDs) |
310 if err != nil { |
310 if err != nil { |
311 return errors.New("cannot parse account IDs") |
311 return errors.New("cannot parse account IDs") |
312 } |
312 } |
313 |
313 |
314 if opt.accountID > 0 { // Allow --account-id |
314 if opt.accountID != "" { // Allow --account-id |
315 ids = []int64{opt.accountID} |
315 ids = []madon.ActivityID{opt.accountID} |
316 } |
316 } |
317 if len(ids) < 1 { |
317 if len(ids) < 1 { |
318 return errors.New("missing account IDs") |
318 return errors.New("missing account IDs") |
319 } |
319 } |
320 |
320 |