awaescher/RepoZ

Support cmder

jods4 opened this issue · 9 comments

jods4 commented

Cmder is a great console emulator for Windows.

I use it for everything git-related so I'd love if I could replace the "Open in Windows Powershell" entry by "Open in Cmder" (or at least add that option to the list)

Thanks for the suggestion. I'd like to close this issue in favor for #114, which makes the context menu custimizable.
I'd add a note about Cmder over there.

I finally started to work on #114 and set up a new repository to consolidate repository actions from the community.

Would you like to help out adding Cmder to the json file over there?

jods4 commented

@awaescher Fantastic! Menu and esp. shortcut customisation is the last missing piece to make RepoZ perfect!

I will gladly help you put up a template for Cmder.
Cmder is a cmd/terminal/powershell alternative so you basically want to open a prompt inside the git project folder.
The command to do that is cmder /start [location] (documentation)

The main issue when I see your template is that you seem to always give a full path to the executable.
As you can see on the cmder homepage, it's a fully portable tool and you can unzip it anywhere you want...
It's the kind of tool that you'd put on your path though, so assuming you can put global commands in your template I suggest:

{
  "name": "Open in Cmder",
  "executables": ['cmder.exe'],
  "arguments": '/start "{Repository.SafePath}"',
  "keys": "Ctrl+C",
  "active": "true"
}

If the unknown path location is a problem:

  • maybe assume program files and/or localappdata?
  • try the command where cmder to find out?
  • we can modify the template manually anyway (mine is in C:\Tools\Cmder for example).

That was fast, wow.

Yeah, PATH tools are a bit of a problem by now as I have to check whether the executables exist or not before building the menu. This does not work with commands from the PATH.

I might need to overthink that behavior. I'll add Cmder to the sample configuration, thanks again.

Oh, the shortcut is the same as "Copy". I'd like to change that for the sample.

jods4 commented

Sure, no problem. Maybe Ctrl+R for "run"? or Ctrl+T for "terminal"?

jods4 commented

I have to check whether the executables exist or not before building the menu. This does not work with commands from the PATH

Maybe when the executable is just a filename, probe the system with the command where cmder.exe?
It'll tell you if cmder.exe is on the PATH -- and where it is found (notice where can return multiple lines if the same exe is multiple times on path).

jods4 commented

@awaescher Can I suggest a small tweak to the Cmder invocation?

Cmder is a tabbed console, the command I gave you above would create one new window at every invocation, regardless whether Cmder is already open or not.

I think a better default behaviour is to add a new tab to the existing window if it's already open, which can be done with the /single switch:

"arguments": '/single /start "{Repository.SafePath}"'

Thank you very much for this information, I just commited this to RepoZ-RepositoryActions.

RepoZ is not ready to use these definitions yet but I'll be soon 😅