horeah / PyCmd

Improved interactive experience for Windows' cmd.exe
GNU Lesser General Public License v3.0
18 stars 4 forks source link

Feature Request: Auto inject into cmd like clin whenever cmd is called. #15

Open ibay770 opened 7 months ago

ibay770 commented 7 months ago

Is it possible to inject pycmd into a cmd instance when it is called like clink? Thanks in advance.

horeah commented 7 months ago

The way PyCmd works is completely different from clink; I (for one) don't see how we could inject it automatically in a cmd instance (@Spavid04 might have an opinion here).

Why do you need this? What are you trying to achieve? There are probably decent workarounds for most use-cases...

Spavid04 commented 7 months ago

I just had a quick look into clink, and the way they do is:

I don't see this as a viable feature, at the very least until PyCmd is a complete cmd replacement, but PyCmd could allow being autorun in the same way. I tried setting the AutoRun key on my machine, and starting cmd also starts an ""embedded"" PyCmd, but this stars an infinite loop, because the first thing to do is start a cmd. I guess this could be improved so at least users can set the AutoRun key themselves and not carpet bomb their system. All in all I propose two changes: call nested cmd's with /D (that stops AutoRun from being called), and at startup check if the parent process is a bare cmd (ie strictly without any arguments) and exit if not. The second change might need some polish, though.

horeah commented 6 months ago

I think PyCmd is more "intrusive" than clink, and alters the behavior of some commands (e.g. cd works a bit differently, and so do quoting and escaping). For this reason, I would be wary about completely replacing cmd.exe with PyCmd; I would rather recommend tweaking the way(s) in which interactive sessions are being started, e.g. have the terminal application start PyCmd be default -- @ibay770 how are you typically starting your interactive command line sessions?

p.s. even running nested cmd's with /D sounds a bit risky, what if someone uses the AutoRun key to setup their environment (such as PATH, or who knows what else).