-
Notifications
You must be signed in to change notification settings - Fork 0
/
wikis.go
41 lines (33 loc) · 1.03 KB
/
wikis.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
package main
import (
"context"
"flag"
"github.com/artur-sak13/gitmv/provider"
)
const wikisHelp = `Migrate all wikis from one Git provider to another.`
func (cmd *wikisCommand) Name() string { return "wikis" }
func (cmd *wikisCommand) Args() string { return "[OPTIONS]" }
func (cmd *wikisCommand) ShortHelp() string { return wikisHelp }
func (cmd *wikisCommand) LongHelp() string { return wikisHelp }
func (cmd *wikisCommand) Hidden() bool { return false }
func (cmd *wikisCommand) Register(fs *flag.FlagSet) {}
type wikisCommand struct{}
func (cmd *wikisCommand) Run(ctx context.Context, args []string) error {
return runCommand(ctx, cmd.handleWikis)
}
// handleWikis will return
func (cmd *wikisCommand) handleWikis(ctx context.Context, src, dest provider.GitProvider) error {
repos, err := src.GetRepositories()
if err != nil {
return err
}
for _, repo := range repos {
if repo.Fork || repo.Empty {
continue
}
if err := provider.MigrateWiki(repo, dest.GetAuth()); err != nil {
return err
}
}
return nil
}