-
Notifications
You must be signed in to change notification settings - Fork 0
/
info.go
47 lines (37 loc) · 889 Bytes
/
info.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package cmd
import (
"fmt"
"log"
"github.com/pinheirolucas/insta_cleaner/helper"
"github.com/spf13/cobra"
)
// infoCmd represents the info command
var infoCmd = &cobra.Command{
Use: "info",
Short: "Get instagram user info bu name",
Run: runInfo,
}
func init() {
userCmd.AddCommand(infoCmd)
}
func runInfo(cmd *cobra.Command, args []string) {
if len(args) == 0 {
createError("no username provided")
}
uname := args[0]
c, err := loadConfig()
if err != nil {
handleError(err)
}
insta, err := helper.InitLocalGoinsta(c.username, c.password, c.session)
if err != nil {
log.Fatalf("helper.InitLocalGoinsta: %v \n", err)
}
user, err := insta.Profiles.ByName(uname)
if err != nil {
decorateError(err, "not able to unfollow %s ignoring", uname)
}
fmt.Println("id:", user.ID)
fmt.Println("username:", user.Username)
fmt.Println("name:", user.FullName)
}