Doesn't find scripts in PATH
When I try to run a script that's in my PATH (on Windows 8.1), I get:
internal error: could not find script
cargo-script should find scripts if they are in PATH.
I don't agree on that. Searching through and executing anything in PATH makes me very nervous.
The way I envisaged this being solved on Windows was to support scripts with a .crs extension. You should then be able to set run-cargo-script as the interpreter for this extension, and add .CRS to the PATHEXT environment variable. At that point, the shell itself will search PATH, as it should.
Of course, I never got around to writing the code to do any of this directly. Partly because it seemed unlikely anyone would want this, and partly because Microsoft seems to keep changing its mind on how file associations work, and I couldn't be bothered to deal with that.
If you really want this, I can look into it more... but given that I use Windows 7 (and absolutely refuse to touch Windows 10), I don't know if I can even write something that will work on 8/10.
Yes, I also refuse to upgrade to Win 10, I'm still using 8.1 (without Metro UI). I'm curious, why do you think that Win 7 is better than 8.1? Does it have lower audio latency or something?
It would be nice to be able to execute the scripts that are in PATH. Otherwise their usefulness/convenience is very limited (compared to compiling normal Rust executables and putting those in a folder in PATH). Why does it make you nervous if cargo script searches in directories in PATH if the called script is not in the current folder? With .crs file extensions, my editor (sublime) won't syntax highlight them anymore...
It would be nice to be able to execute the scripts that are in PATH.
The shell will already do that, assuming the appropriate file association exists. For example, Python on Windows associates .py and .pyw files with the py launcher, so you can just name the script directly to execute it.
If you add the language's extension to PATHEXT, then it even allows you to omit the file extension like with .exe, .cmd, etc.
Why does it make you nervous if cargo script searches in directories in PATH if the called script is not in the current folder?
Because I have never encountered a script runner that did this, and would be hugely surprised if I ever did. It's just not a behaviour I expect. I don't expect py to go searching my disk looking for a script to execute; I expect it to execute the script I tell it to based on the relative path, or fail. To be honest, the thought of a program like cargo-script doing what you describe makes my skin crawl; it's the kind of magic I absolutely do not want in tools I use.
With .crs file extensions, my editor (sublime) won't syntax highlight them anymore...
There's a menu option to fix that. View → Syntax → Open all with current extension as...
Another option would be to just associate .rs with cargo-script, but I suspect that's probably not what you want, either.
I suppose I could implement this behind a feature gate, but I really strongly feel this is the wrong way to go about solving this problem. Doing file associations means you could do thing args instead of cargo script -- thing args.
As for Windows 8, the short version is: it added nothing I cared about, and was worse with things I did care about. Windows 10 was the same, only significantly more so.
FYI, 0.2.0 contains code to create appropriate file associations, which will let you run scripts on PATH directly.