1
0
Fork 0

feat: clone

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main
jolheiser 2023-11-24 17:25:51 -06:00
parent 8df1405bac
commit 8ec5210d70
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
1 changed files with 26 additions and 0 deletions

View File

@ -25,6 +25,32 @@ def nixdev [
^nu -c $cmd
}
def "forge types" [] {
["github", "gitea", "jojodev", "codeberg"]
}
def clone [
repo: string # Repo name
--forge (-f) = "github": string@"forge types" # Forge type (github, gitea, jojodev, codeberg)
--owner (-o): string # Owner (default: current dir name)
] {
let owner = ($env.PWD | path basename)
mut id = 'gh'
if $forge == 'gitea' {
$id = 'gt'
} else if $forge == 'jojodev' {
$id = 'jj'
} else if $forge == 'codeberg' {
$id = 'cb'
}
let origin = $'ssh:($id):jolheiser/($repo).git'
let upstream = $'($id):($owner)/($repo).git'
^git clone $origin
cd $repo
^git remote add upstream $upstream
^git fetch upstream
}
## Other ##
$env.EDITOR = hx
$env.config = ($env.config | upsert "shell_integration" ("WEZTERM_PANE" not-in $env and "SSH_CLIENT" not-in $env))