How to add arguments that has the form of [arg1, arg2, ...] ? #231
Replies: 2 comments
-
That's a very unusual command line format. In order to satisfy, you will probably need to write something like this: var result = await Cli.Wrap(registrationPath)
.WithArguments(args => args
.Add("--output")
.Add(["[", outputPrefix, ",", outputWarp, ",", outputInverse, "]"])
).ExecuteBufferedAsync(); Or: var result = await Cli.Wrap(registrationPath)
.WithArguments(["--output", "[", outputPrefix, ",", outputWarp, ",", outputInverse, "]"])
).ExecuteBufferedAsync(); Or adapted from your var result2 = await Cli.Wrap(registrationPath)
.WithArguments(args => args
.Add("--output")
.Add($"[{outputPrefix}, {outputWarp}, {outputInverse} ]", false)
).ExecuteBufferedAsync(); |
Beta Was this translation helpful? Give feedback.
-
Thank you! I just found that the it is not the double quote that makes the error, it is that the space between square brackets and the string of directory that makes the error. If I delete the space between square brackets and the string of directory it works fine. |
Beta Was this translation helpful? Give feedback.
-
Hi, I am using CliWrap to call exe within C#. As for my exe, there's arguments like:
antsRegistration --output [ E:\Dir\To\Output\LHoutput, E:\Dir\To\Output\LHoutputWarped.nii.gz,E:\Dir\To\Output\LHoutputInverseWarped.nii.gz ]
I tried to formulate the arguments that is in the square brackets in three ways, none of it has same effect as the above:
(outputPrefix, outputWarp and outputInverse are strings corresponding to E:\Dir\To\Output\LHoutput, E:\Dir\To\Output\LHoutputWarped.nii.gz and E:\Dir\To\Output\LHoutputInverseWarped.nii.gz)
method 1:
the arguments has no square brackets(also missing comma):
method 2:
the arguments has extra quotes:
method3:
the arguments are same as method 1:
I appreciate if anyone could help me solve this issue. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions