You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Please implement getting project by namespace/name #28
Currently gitlab cli supports 'project get' by project id only, while Gitlab API supports getting specific project also by namespace/project_name
"Get a specific project, identified by project ID or NAMESPACE/PROJECT_NAME, which is owned by the authenticated user. If using namespaced projects call make sure that the NAMESPACE/PROJECT_NAME is URL-encoded, eg. /api/v3/projects/diaspora%2Fdiaspora (where / is represented by %2F)."
In this way user can get project ID knowing only it's name and reuse this ID later (to add milestone or issue etc.)
Currently I have to store project ID's somewhere to use them with CLI.
I could also try to use "project search" or parse output from "project list" command but it's overcomplicated.
Does this only apply to 'gitlab project' or 'gitlab project get' or should you not expect this same symbolic naming for other commands/subcomamnds that have a --project-id or --id? ex: 'gitlab project-commit-comment list --commit-id ... --project-id' This is still expecting a number.
If so I'd highly recommend this in every instance where a --project-id or --id that a group/project should be allowed.
If you agree would you like a issue per command or per subcommand or a large meta issue be alright?
I'm able to use path%2fname for --project-id and --group-id everywhere I've tried it, including subgroup projects. Though I would greatly prefer '/' instead of '%2f'.
My 100th first try at doing python but I think this should fix it?
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py
index 939a7cc..fb84be3 100644
--- a/gitlab/v4/cli.py
+++ b/gitlab/v4/cli.py
@@ -42,6 +42,8 @@ class GitlabCLI(object):
# parents, build the chain of managers to get to the final object.
# Instead we do something ugly and efficient: interpolate variables in
# the class _path attribute, and replace the value with the result.
+ if 'project_id' in self.args:
+ self.args['project_id'] = self.args['project_id'].replace('/', '%2F')
self.mgr_cls._path = self.mgr_cls._path % self.args
self.mgr = self.mgr_cls(gl)
Activity
cdbennett commentedon Dec 23, 2015
I think this is broken again. Tested on 0.9+ (acc1511). I have to specify
%2Finstead of a slash:Sanitize the id used to construct URLs
cdbennett commentedon Dec 30, 2015
👍 Awesome, tested and fixed.
derekschrock commentedon Feb 11, 2018
Does this only apply to 'gitlab project' or 'gitlab project get' or should you not expect this same symbolic naming for other commands/subcomamnds that have a --project-id or --id? ex: 'gitlab project-commit-comment list --commit-id ... --project-id' This is still expecting a number.
If so I'd highly recommend this in every instance where a --project-id or --id that a group/project should be allowed.
If you agree would you like a issue per command or per subcommand or a large meta issue be alright?
gpocentek commentedon Feb 14, 2018
@derekschrock this works for
project getbut not for other subcommands (--project-id namespace/namedoesn't work).I'd rather have a single issue. Thanks!
jgeorgeson commentedon Feb 14, 2018
I'm able to use
path%2fnamefor--project-idand--group-ideverywhere I've tried it, including subgroup projects. Though I would greatly prefer '/' instead of '%2f'.derekschrock commentedon Feb 15, 2018
Appears to be a v4 issue? Works as expected in v3.
derekschrock commentedon Feb 15, 2018
derekschrock commentedon Feb 17, 2018
My 100th first try at doing python but I think this should fix it?