-help missing most command line options?
ASchmidt1 opened this issue · 4 comments
First of all: Thank you to all contributors.
Never mind...
shawl add --help
provided much of the information sought.
No worries! I've added a small note to the README just in case.
That's okay; no harm in asking :)
Actually, while writing up an example, I realized that cmd.exe rejects the UNC working directory that Shawl tries to give it when you use --cwd
, which makes cmd.exe fall back to an incorrect directory. Not sure if that was part of the issue you were facing, but I just released the fix in v1.2.0, so I recommend upgrading just in case.
Aside from that, you only need to quote the individual arguments, and only if they contain spaces. Give this a try:
shawl add --log-dir C:\Logfiles --name "Solr (Lucene Search Server)" --cwd C:\solr\8.11\bin -- solr.cmd start -f -s E:\Solr_Home
If that doesn't work, then please show me the exact error you get.
Here's a full example using Command Prompt:
$ type C:\tmp\script.cmd
echo script cwd = %cd%, arg 1 = %1, arg 2 = %2 >> script.log
$ shawl.exe add --name shawl-demo --cwd C:\tmp -- script.cmd "foo bar" baz
$ sc start shawl-demo
$ type C:\tmp\script.log
script cwd = C:\tmp, arg 1 = "foo bar", arg 2 = baz
I don’t think the documentation makes clear whether I’m supposed to specific the .cmd file itself as the “command”, followed by its parameters as one string, or if I’m supposed to shell executable as the “command” and the .cmd file with parameters as the input to the command shell, etc etc.
It's pretty flexible. A *.cmd
file or cmd.exe
are both fine, but the arguments should be passed as separate strings (unless your program really expects a single string with all the options).
You should be able to take most valid CLI invocations and stick them after the --
as-is, although you do have to take care with nested quotes. Here's an example using cmd.exe (fortunately /C
doesn't seem to actually require quotes, which makes it easier):
$ shawl.exe add --name shawl-demo --cwd C:\tmp -- cmd.exe /C script.cmd "foo bar" baz
$ sc start shawl-demo
$ type C:\tmp\script.log
script cwd = C:\tmp, arg 1 = "foo bar", arg 2 = baz