-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimport.go
More file actions
32 lines (25 loc) · 699 Bytes
/
import.go
File metadata and controls
32 lines (25 loc) · 699 Bytes
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
package main
import "gopkg.in/urfave/cli.v2"
// Import imports labels from a repository to another
func Import(c *cli.Context) error {
// Check argc
if c.NArg() != 2 {
return cli.Exit(missingRepo, 1)
}
// Parse argument to retrieve repository
userFrom, repoFrom, err := parseRepository(c.Args().Get(0))
if err != nil {
return cli.Exit(err.Error(), 1)
}
labels, err := get(userFrom, repoFrom, c.String("token"))
if err != nil {
return cli.Exit(err.Error(), 1)
}
// Parse argument to retrieve repository
userTo, repoTo, err := parseRepository(c.Args().Get(1))
if err != nil {
return cli.Exit(err.Error(), 1)
}
set(userTo, repoTo, c.String("token"), labels)
return nil
}