iridakos / goto

Alias and navigate to directories with tab completion in Linux
https://iridakos.com/programming/2019/04/10/shell-navigation-with-autocomplete
MIT License
873 stars 63 forks source link

Don't require completion for unambiguous alias #15

Closed dmd closed 6 years ago

dmd commented 6 years ago

I should be able to say:

goto fo

and if that is a unique prefix in .goto, we should go there without me having to press tab as well.

dmd commented 6 years ago

I'm not sure what the correct behavior for an ambiguous prefix is. I think the correct thing would be to say, for example:

$ goto fo
goto error: ambiguous alias fo
foodata /u/ddrucker/dmdenv/data/serial/foo/main
foo /u/ddrucker/dmdenv/private_sand/foo/mp
$

rather than just guessing.

iridakos commented 6 years ago

Hi @dmd

goto expects the exact alias literal to be passed in order to navigate to the underlying directory.

If user executes:

goto fo

and there is an alias named fo then nothing should be displayed and user should be navigated to fo's registered directory regardless of the existence of other aliases starting with fo or not.

If there is no fo alias then the default error message for unregistered alias will be displayed.

Regarding autocompletion, executing goto fo will take user to the underlying directory. If instead of executing the command, user presses the <tab> key then the completion mechanism will display all options (including fo, foodata) which is the default completion behaviour.

I'm closing this issue but feel free to re-open it if you need more clarifications.

Thank you for reporting

dmd commented 6 years ago

Right. That's the behavior modification I was thinking would be nice - to be able to just say "goto fo", and if and only if there was exactly one alias matching /^fo.*$/, then navigate to that alias without the need to hit tab for autocomplete.

But if you don't think that's a good idea, that's fine.