39 |
39 |
40 //suggestionsGetSubcommand.Flags().UintVarP(&suggestionsOpts.limit, "limit", "l", 0, "Limit number of API results") |
40 //suggestionsGetSubcommand.Flags().UintVarP(&suggestionsOpts.limit, "limit", "l", 0, "Limit number of API results") |
41 suggestionsGetSubcommand.Flags().UintVarP(&suggestionsOpts.keep, "keep", "k", 0, "Limit number of results") |
41 suggestionsGetSubcommand.Flags().UintVarP(&suggestionsOpts.keep, "keep", "k", 0, "Limit number of results") |
42 //suggestionsGetSubcommand.Flags().BoolVar(&suggestionsOpts.all, "all", false, "Fetch all results") |
42 //suggestionsGetSubcommand.Flags().BoolVar(&suggestionsOpts.all, "all", false, "Fetch all results") |
43 |
43 |
44 suggestionsDeleteSubcommand.Flags().Int64VarP(&suggestionsOpts.accountID, "account-id", "a", 0, "Account ID number") |
44 suggestionsDeleteSubcommand.Flags().StringVarP(&suggestionsOpts.accountID, "account-id", "a", "", "Account ID number") |
45 suggestionsDeleteSubcommand.Flags().StringVar(&suggestionsOpts.accountIDs, "account-ids", "", "Comma-separated list of account IDs") |
45 suggestionsDeleteSubcommand.Flags().StringVar(&suggestionsOpts.accountIDs, "account-ids", "", "Comma-separated list of account IDs") |
46 } |
46 } |
47 |
47 |
48 var suggestionsSubcommands = []*cobra.Command{ |
48 var suggestionsSubcommands = []*cobra.Command{ |
49 suggestionsGetSubcommand, |
49 suggestionsGetSubcommand, |
114 return p.printObj(obj) |
114 return p.printObj(obj) |
115 } |
115 } |
116 |
116 |
117 func suggestionsDeleteRunE(cmd *cobra.Command, args []string) error { |
117 func suggestionsDeleteRunE(cmd *cobra.Command, args []string) error { |
118 opt := suggestionsOpts |
118 opt := suggestionsOpts |
119 var ids []int64 |
119 var ids []madon.ActivityID |
120 var err error |
120 var err error |
121 |
121 |
122 if opt.accountID < 1 && len(opt.accountIDs) == 0 { |
122 if opt.accountID == "" && len(opt.accountIDs) == 0 { |
123 return errors.New("missing account IDs") |
123 return errors.New("missing account IDs") |
124 } |
124 } |
125 if opt.accountID > 0 && len(opt.accountIDs) > 0 { |
125 if opt.accountID != "" && len(opt.accountIDs) > 0 { |
126 return errors.New("incompatible options") |
126 return errors.New("incompatible options") |
127 } |
127 } |
128 |
128 |
129 ids, err = splitIDs(opt.accountIDs) |
129 ids, err = splitIDs(opt.accountIDs) |
130 if err != nil { |
130 if err != nil { |
131 return errors.New("cannot parse account IDs") |
131 return errors.New("cannot parse account IDs") |
132 } |
132 } |
133 if opt.accountID > 0 { // Allow --account-id |
133 if opt.accountID != "" { // Allow --account-id |
134 ids = []int64{opt.accountID} |
134 ids = []madon.ActivityID{opt.accountID} |
135 } |
135 } |
136 if len(ids) < 1 { |
136 if len(ids) < 1 { |
137 return errors.New("missing account IDs") |
137 return errors.New("missing account IDs") |
138 } |
138 } |
139 |
139 |