diff options
author | daylin <47667941+daylinmorgan@users.noreply.github.com> | 2023-09-30 07:53:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-30 14:53:09 +0200 |
commit | c3b95cbd2c944512585b843df7f0920894cf16ae (patch) | |
tree | 06b36a5ef7cd7fc34df7ea81324b8d05b6a652d9 | |
parent | b2ca6bedae6420396682cbf06b3c628cfcf9baf1 (diff) | |
download | Nim-c3b95cbd2c944512585b843df7f0920894cf16ae.tar.gz |
docs: add another switch example for nimscript (#22772)
I couldn't find any documentation on the syntax for --hint:X:on|off with `nimscript` except in [this old forum post](https://forum.nim-lang.org/t/8526#55236).
-rw-r--r-- | doc/nims.md | 2 | ||||
-rw-r--r-- | lib/system/nimscript.nim | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/doc/nims.md b/doc/nims.md index 01cdf47c3..42cc6e124 100644 --- a/doc/nims.md +++ b/doc/nims.md @@ -124,6 +124,8 @@ Here are few examples of using the `switch` proc: switch("define", "release") # command-line: --forceBuild switch("forceBuild") + # command-line: --hint[Conf]:off or --hint:Conf:off + switch("hint", "[Conf]:off") ``` NimScripts also support `--`:option: templates for convenience, which look diff --git a/lib/system/nimscript.nim b/lib/system/nimscript.nim index a2c897b04..bdf6145a1 100644 --- a/lib/system/nimscript.nim +++ b/lib/system/nimscript.nim @@ -161,6 +161,7 @@ template `--`*(key, val: untyped) = ## ```nim ## --path:somePath # same as switch("path", "somePath") ## --path:"someOtherPath" # same as switch("path", "someOtherPath") + ## --hint:"[Conf]:off" # same as switch("hint", "[Conf]:off") ## ``` switch(strip(astToStr(key)), strip(astToStr(val))) |