-
Notifications
You must be signed in to change notification settings - Fork 360
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
lakectl autocomplete with repository name #4320
Conversation
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.
- Prefix extraction seems broken: I think all repositories are always fetched.
- Couldn't get it to work on my machine (Mac + Zsh).
cmd/lakectl/cmd/validargs.go
Outdated
// extract repository name written so far | ||
var prefix api.PaginationPrefix | ||
if strings.HasPrefix(toComplete, uriPrefix) { | ||
idx := strings.Index(toComplete[len(uriPrefix):], uri.PathSeparator) |
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.
Doesn't the previous if entail that idx is always -1 here?
At this point, I think you should take everything after the uriPrefix as the prefix for the query.
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.
True, fixing.
Thanks for the review - fixing the prefix use. if you like to get it working on your mac, try: |
@nopcoder worked! Thanks |
Pushed the fix - now the repository prefix passed to to the api call. |
|
||
// extract repository name written so far | ||
var prefix api.PaginationPrefix | ||
if strings.HasPrefix(toComplete, uriPrefix) { |
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.
If it doesn't have the lakefs://
prefix, we still want an autocomplete, no?
So maybe the prefix should be "toComplete".
For example, if I'm doing lakectl branch create my-rep<TAB>
, I want to get: lakectl branch create lakefs://my-repo
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.
Wanted to give the same autocomplete behaviour we have with other application - when the prefix you enter doesn't match any of the possible options we do not suggest completion.
Example: docker autocompete will match the prefix to the image name - but if you will find me a other working reference I will consider :)
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.
Nice feature!! See another comment
Enhance the auto-complete with auto complete by listing the current repositories.
This is the first step in enable better user-experience while working from the command line.
Next step will be to enable specific tag/branch/commit and path.
Part of #654