mridgers / clink

Bash's powerful command line editing in cmd.exe
mridgers.github.io/clink
GNU General Public License v3.0
3.22k stars 283 forks source link

Allow piping to doskey macros #168

Open ghost opened 10 years ago

ghost commented 10 years ago

From AustinWa...@gmail.com on December 09, 2013 23:03:24

What steps will reproduce the problem? 1. doskey md5=md5sum

  1. echo foo | md5 What is the expected output? What do you see instead? Expected md5 checksum of "foo". Instead see "'md5' is not recognized as an internal or external command, operable program or batch file." What version of the product are you using? On what operating system? Clink 0.4, Win 7 x64 Please provide any additional information below. The default doskey macro behavior is limited compared to alias in bash. Would be useful if Clink applied expansion to macros after pipes.

Original issue: http://code.google.com/p/clink/issues/detail?id=169

ghost commented 10 years ago

From martin.r...@gmail.com on December 17, 2013 15:40:56

Yeah, this bothers me too. Perhaps it's about time Clink offered an improvement in this area!

Status: Accepted
Owner: martin.r...@gmail.com

7fe commented 8 years ago

I can't tell really but this hasn't really been attempted yet has it?

I wouldn't might attempting it although I would guess much of this goes over my head.

mridgers commented 8 years ago

It hasn't been attempted. You're welcome to try of course. Doskey is actually a feature of Windows' ReadConsole() API and not really part of cmd.exe. Because cmd.exe intercepts and redirect calls to ReadConsole() the alias expansion that it would ordinarily do gets skipped. So Clink emulates this, all of which is implemented in doskey.c. One could consider improving that emulation to tokenise on | and expand each substring.