cmd/madon.go
changeset 268 4dd196a4ee7c
parent 265 05c40b36d3b2
parent 267 5b91a65ba95a
equal deleted inserted replaced
266:80973a656b81 268:4dd196a4ee7c
     4 // Please see the LICENSE file is this directory.
     4 // Please see the LICENSE file is this directory.
     5 
     5 
     6 package cmd
     6 package cmd
     7 
     7 
     8 import (
     8 import (
     9 	"strconv"
       
    10 	"strings"
     9 	"strings"
    11 
    10 
    12 	"github.com/McKael/madon/v3"
    11 	"github.com/McKael/madon/v3"
    13 	"github.com/pkg/errors"
    12 	"github.com/pkg/errors"
    14 	"github.com/spf13/viper"
    13 	"github.com/spf13/viper"
   102 	}
   101 	}
   103 	return errors.Wrap(err, "login failed")
   102 	return errors.Wrap(err, "login failed")
   104 }
   103 }
   105 
   104 
   106 // splitIDs splits a list of IDs into an int64 array
   105 // splitIDs splits a list of IDs into an int64 array
   107 func splitIDs(ids string) (list []int64, err error) {
   106 func splitIDs(ids string) (list []madon.ActivityID, err error) {
   108 	var i int64
       
   109 	if ids == "" {
   107 	if ids == "" {
   110 		return
   108 		return
   111 	}
   109 	}
   112 	l := strings.Split(ids, ",")
   110 	l := strings.Split(ids, ",")
   113 	for _, s := range l {
   111 	for _, s := range l {
   114 		i, err = strconv.ParseInt(s, 10, 64)
   112 		if s == "" {
   115 		if err != nil {
       
   116 			return
   113 			return
   117 		}
   114 		}
   118 		list = append(list, i)
   115 		list = append(list, s)
   119 	}
   116 	}
   120 	return
   117 	return
   121 }
   118 }