-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup.sh
More file actions
executable file
·30 lines (20 loc) · 811 Bytes
/
backup.sh
File metadata and controls
executable file
·30 lines (20 loc) · 811 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
#! /usr/bin/env nu
# TODO:
# - allow to run script from windows host
# - update ghorg version
# - migrate to new fine-grained tokens on Github
let gh_token = (input -s "Input Github Personal Access Token: ")
print "\nCloning all the repos from github to local folder"
./ghorg clone meskill --config ./ghorg-config.yml --ghorgignore-path ./ghorgignore --path $env.PWD --token $gh_token
print "\nPushing all the repos to the sourcehut"
ls ./**/HEAD | each {|it|
let dir = ($it.name | path dirname)
cd $dir
try {
^git remote get-url sourcehut err> /dev/null
} catch {|err|
let parsed = (^git remote get-url origin | parse -r "git@[^:]+:(?<repository_name>[^.]+).git");
^git remote add sourcehut $"git@git.sr.ht:~($parsed.repository_name.0)"
}
^git push sourcehut --all
} | ignore