No, the Tools command is not for cmd.exe. It just runs the command. You could run a cygwin program as a tool. For example, put "c:\cygwin\bin\ls.exe" as the tool command and run it and you'll get a directory listing in the output window.
But you'll run into a couple of problems. Specifically, Windows paths ("C:\documents and settings\...") won't work with most cygwin tools, and lots of cygwin tools will require various environment variables to be set, which won't be set in this context (except maybe if you started PN from a bash prompt or some such).
With a bit of creativity, these shouldn't be showstoppers, though.
To confront the first issue, you can take advantage of the "cygpath" tool which comes with Cygwin. It can convert back and forth between Windows style paths and unix style paths.
The easiest way to confront the second problem is probably by invoking a bash login shell, which will set up the environment, and then having your Cygwin tools run from within there.
Let's do an example, shall we?
Say we want a tool which will invoke g++ on the file in the editor. If the file is named helloworld.cpp, we want the output file to be helloworld.exe.
To do this, we want to run bash and then have bash enter the directory that helloworld.cpp is in (this is easiest) and then run g++ helloworld.cpp -o helloworld.exe.
So let's create a little helper shell script in your cygwin home directory. Create a file called run.sh and put the following in it:
#!/bin/bash
declare p=$(cygpath -u "$1")
cd "$p"
$2 $3 $4 $5 $6 $7 $8 $9
Then add the Tool to PN:
Call it g++.
For the command, enter: c:\cygwin\bin\bash.exe
For parameters, enter: --login run.sh "%d\" g++ "%f" -o "%n.exe"
If you look at what this does...
- the Tool runs bash.exe --login run.sh ...
- bash sets up the environment (--login) and then invokes run.sh with the positional arguments ($1, $2, etc.) as:
- the directory name of the file in the editor (%d)
- g++
- the filename of the file in the editor (helloworld.cpp) (%f)
- -o
- the file title+.exe (helloworld.exe) (%n.exe)
- Now run.sh...
- uses cygpath to convert the first positional argument into a unix-style path
- changes to that directory
- takes the rest of the parameters (in this case "g++ helloworld.cpp -o helloworld.exe") and runs them as a command
Note that the file and directory names are put in quotes since they may contain spaces.
Also note a little hack: the directory name (%d) is followed by another backslash. This is because %d expands into the directory name followed by a backslash, which would then "escape" the following doublequote when the commandline is parsed. So this way you actually have the directory end up with a trailing double backslash, which then cygpath converts to a double trailing forward slash, i.e. "/cygdrive/c/documents and settings/user/desktop//". Fortunately, this doesn't cause a problem.
Hope this helps.