awaescher / RepoZ

👨‍💻 A zero-conf git repository hub for Windows and macOS with Windows Explorer- & CLI-enhancements
MIT License
1.01k stars 91 forks source link

grr cd when there are multiple repos with the same name #111

Closed simonmarklar closed 3 years ago

simonmarklar commented 4 years ago

I have multiple repos all called "api" (a loose company naming policy as we do a bunch of projects for various clients) - so I understand this is probably an outlier and technically I can work around the issue, however grr should speed up working with git like the hub does and for me its not providing much value in this (rather particular) circumstance

In windows terminal using a powershell prompt using grr cd api I get the following results:

 [1]  api   master ≡ ⁞2
 [2]  api   ON-6945 ⌂ +10 ~0 -0 | +0 ~8 -4 ⁞1

Found multiple repositories, using api.
You can access the others by index now, like:
  grr cd :2

however the first repo location is automatically typed seemingly char by char (and kinda slowly too, takes about 1-2 seconds on some of my repo paths), after which i can then type grr cd :2 (and wait for the typing to finish). Alternatively i can use grr cd api "p <filter>" to do it in one command, however this also suffers from the slow writing of the cd command to the prompt

The whole process is marginally faster than just typing out the repo name using tab completion, eg cd ~/src/gitlab.com/company-name/project-name/api/

it would be great if

aside from this one use case, it really does grr help switching between the other repos super fast

awaescher commented 4 years ago

Hi Simon,

I really like the way you write your issues with "don't bother, it might just be me on this planet that suffers from this".

Speed up the path typing ... Hm. you see, the way I do this is by sending key strokes to the CLI process that called grr.exe. That's a kind of a hack, but all those CLI tools the developers are using (like Windows Terminal wt.exe, cmd.exe, powershell.exe, bash.exe, ...) are very very different internally but share one same concept: As CLI tools, they require key strokes to form commands to execute. That's what grr does: It finds out which process it was started from and sends keys to the corresponding process id.

I know this is not perfect as end user because sometimes these chars appear one by one. While this is happening, you should not type anything because that would interrupt with the commands grr is sending. And you cannot chain commands like grr cd api; git pull; git switch -c feature/NewFeature, etc. But I have no better idea that sending keystrokes - let me know if you do. If I'd have to support PowerShell only, I could write a PowerShell module which would call RepoZ via IPC and change the directory - but I want to support all CLI tools.

Anyway, I'll think about the last two bullets, thanks for the hint.

simonmarklar commented 4 years ago

interesting - i naively assumed you could do the standard writeLine or whatever it is called in c# (its been way too long) or even something like exec "cd <path>" but i am not very up to speed with the ins and outs of console programming outside of nodejs nor the intricacies of your project

and yeah, i am well aware that we all have day jobs, lives and other responsibilities outside of git hub and when the "problem" has (multiple) work arounds the problem should be low priority... i'm loving repoZ tho and if my issue has a solution sometime in the future i'll be happy as larry but honestly i cant think of many situations where people would have two repos with the same name so i dont expect it to be anywhere near the top of your priority list

awaescher commented 3 years ago

Hi Simon,

I just re-checked your issue and asked myself if this is still a thing with version 5.4.

Because back in August, I changed the way grr works which should speed up the "typing thing". In fact, the path is now stuffed into the clipboard and the only keys that are sent to the CLI tools are Ctrl+V. As said, this should speed up the process a lot and it is not as likely to interfere with the "grr typing" anymore if you hit some keys at the same time by yourself.

simonmarklar commented 3 years ago

Hi

i've been using 5.4 for a while now and its much better with the copy/paste mechanism. I'm happy for this to be closed :)

awaescher commented 3 years ago

Thanks for your quick reply. With this, I'd love to close this.