-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Remove Requirement for Dotfile #84
Conversation
cmd/main.go
Outdated
return "", fmt.Errorf("Could not get origin remote") | ||
} | ||
|
||
cmd := exec.Command("bash", "-c", "git remote get-url origin | xargs basename -s .git") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gitlab API also allow you to use project path ( namespace and project name ) in API call for getting project information. Would be that more reliable ?
For example I use these aliases for glab
cli tool to get project path , project info and id
project_id !glab project_info | jq ".id"
project_info !glab api $(glab project_path | python -c "import sys,urllib.parse; input = sys.stdin.read(); input = input.strip(\"\n\"); print(f\"/projects/{urllib.parse.quote_plus(input)}\")")
project_path !git ls-remote --get-url | python -c "import sys,re; input = sys.stdin.read(); m = re.match(\".*://git@[^/]*/(.*)|.*git@[^:]*:(.*)|https://[^/]*/(.*)\", input); print(m and (m.group(1) or m.group(2) or m.group(3)))"
It is little bit more parsing though. Or would you mind if we had support for used defined lua function which would return configuration ? That way users could define their own way how to get credentials ( I personally have alias glab token
which returns token from glab settings based on gitlab instance for project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the goal of this MR is to introduce one feature, as per the initial user's request in that ticket, which is to make the .gitlab.nvim
file optional by providing shell variables.
If we wanted to support a third configuration option (the ability to call any arbitrary Lua code to evaluate environment variables) then that'd have to be done as a separate MR.
This MR makes it so that the
.gitlab.nvim
file is optional. If present, the variables provided in this file will override those from the user's environment. This should be a non-breaking change.The API key and Github URL may now be provided as environment variables. The project ID is derived from an API call instead of provided as a variable.
The configuration of the plugin with these variables is now deferred until the first command is actually run, because we need to make an additional API call to fetch the Project ID.