You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cmdline/commandLineParams() (and the parseopt module) is not very friendly with NimScript mode
Description
Currently, when nim is invoked in script mode, cmdline.commandLineParams() returns all the parameters including the flags/arguments that are passed to the nim compiler. For example, with this script (say test.nims):
#!/usr/bin/env -S nim e --hints:offimport std/cmdline
echo"params: ", commandLineParams()
invoking the script via $ ./test.nims foo bar outputs
Ideally I hope it only returns @["foo", "bar"], ignoring the first 3 parameters.
This is annoying because the script needs to ignore the first three parameters to parse correctly. It's more annoying because the number of parameters to ignore depends on what flags/arguments that I pass to nim.
And this makes it very difficult to use the same code both in script mode and in compile mode.
Can it be made so that the script mode strips out the parameters that are passed to nim
Alternatives
No response
Examples
No response
Backwards Compatibility
No response
Links
No response
The text was updated successfully, but these errors were encountered:
Summary
cmdline/commandLineParams()
(and theparseopt
module) is not very friendly with NimScript modeDescription
Currently, when
nim
is invoked in script mode,cmdline.commandLineParams()
returns all the parameters including the flags/arguments that are passed to thenim
compiler. For example, with this script (saytest.nims
):invoking the script via
$ ./test.nims foo bar
outputsIdeally I hope it only returns
@["foo", "bar"]
, ignoring the first 3 parameters.This is annoying because the script needs to ignore the first three parameters to parse correctly. It's more annoying because the number of parameters to ignore depends on what flags/arguments that I pass to
nim
.And this makes it very difficult to use the same code both in script mode and in compile mode.
Can it be made so that the script mode strips out the parameters that are passed to
nim
Alternatives
No response
Examples
No response
Backwards Compatibility
No response
Links
No response
The text was updated successfully, but these errors were encountered: