today I edited this function, found around in internet, on my .zshrc. The point is that, if a enter every single line in shell it works and creates the repo in gitlab. Evoking it as function it returns:
gitdir:5: no matches found: https://gitlab.mine.my/api/v4/projects?private_token=HI-U-ALL
The function is this:
function gitdir() {
repo=$1
token=HI-U-ALL
GITLAB=gitlab.mine.my
test -z $repo && echo "Repo name required." 1>&2 && exit 1
curl -H "Content-Type:application/json" https://$GITLAB/api/v4/projects?private_token=$token \
-d "{ \name\: \$repo\ }" }
The issue is with the "" of the curl call, but I can't solve to problem, there are many workaround but definitely not elegant as a native function. Can anyone suggest a possible solution? Thanks in advance. Rob
I already tried to change the quotation marks but curl is really stuck to them. I'd like to simply automate the procedure
A question mark is a glob character for the shell, and zsh tries to do filename generation in your https parameter. The simplest solution is to wrap the argument between double-quotes. Alternatively, you can escape the question mark:
... "https://$GITLAB/api/v4/projects?private_token=$token" ...
or
... https://$GITLAB/api/v4/projects\?private_token=$token ...