I have a function called auth
and I want to have function parameters but I have no idea how to do that. The function parameters being username
, and repo
. I tried to do it the bash style but it didn't work, searching online didn't help much either. This is what I currently have.
function auth
username = $1
repo = $2
string = "git@github.com:${username}/${repo}"
git remote set-url $string
end
I've also tried
function auth
$username = $1
$repo = $2
$string = "git@github.com:$username/$repo"
git remote set-url {$string}
end
But it didn't work either. The error occurs where I set the variables username
, string,
and repo
~/.config/fish/functions/auth.fish (line 2): The expanded command was empty.
$username = $1
^
in function 'auth' with arguments '1 2'
~/.config/fish/functions/auth.fish (line 3): The expanded command was empty.
$repo = $2
^
in function 'auth' with arguments '1 2'
~/.config/fish/functions/auth.fish (line 5): The expanded command was empty.
$string = "git@github.com:$username/$repo"
^