1
0
Fork 0

fix: respect owner flag in clone command

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main
jolheiser 2023-12-29 10:55:09 -06:00
parent 68b207f960
commit 7eea1dda6a
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
1 changed files with 9 additions and 4 deletions

View File

@ -33,7 +33,6 @@ def clone [
--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'
@ -42,12 +41,18 @@ def clone [
} else if $forge == 'codeberg' {
$id = 'cb'
}
mut namespace = ($env.PWD | path basename)
if $owner != '' {
$namespace = $owner
}
let origin = $'ssh:($id):jolheiser/($repo).git'
let upstream = $'($id):($owner)/($repo).git'
let upstream = $'($id):($namespace)/($repo).git'
^git clone $origin
cd $repo
^git remote add upstream $upstream
^git fetch upstream
if $namespace != 'jolheiser' {
^git remote add upstream $upstream
^git fetch upstream
}
}
def fg [args ...string] {