Created
December 31, 2013 15:35
-
-
Save gradha/8198472 to your computer and use it in GitHub Desktop.
Trying to make docstring appear in all platforms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/pure/os.nim b/lib/pure/os.nim | |
index d74cb1f..e404d8c 100644 | |
--- a/lib/pure/os.nim | |
+++ b/lib/pure/os.nim | |
@@ -1481,7 +1481,19 @@ proc getTempDir*(): string {.rtl, extern: "nos$1", tags: [FReadEnv].} = | |
when defined(windows): return string(getEnv("TEMP")) & "\\" | |
else: return "/tmp/" | |
-when defined(windows): | |
+when defined(nimdoc): | |
+ proc paramStrdoc*(i: int): TaintedString {.tags: [FReadIO].} = | |
+ ## Returns the `i`-th `command line argument`:idx: given to the | |
+ ## application. | |
+ ## | |
+ ## `i` should be in the range `1..paramCount()`, else | |
+ ## the `EOutOfIndex` exception is raised. | |
+ | |
+ proc paramCountdoc*(): int {.tags: [FReadIO].} = | |
+ ## Returns the number of `command line arguments`:idx: given to the | |
+ ## application. | |
+ | |
+elif defined(windows): | |
# Since we support GUI applications with Nimrod, we sometimes generate | |
# a WinMain entry proc. But a WinMain proc has no access to the parsed | |
# command line arguments. The way to get them differs. Thus we parse them | |
@@ -1491,18 +1503,13 @@ when defined(windows): | |
ownArgv: seq[string] | |
proc paramCount*(): int {.rtl, extern: "nos$1", tags: [FReadIO].} = | |
- ## Returns the number of `command line arguments`:idx: given to the | |
- ## application. | |
+ # See docstring in nimdoc block. | |
if isNil(ownArgv): ownArgv = parseCmdLine($getCommandLine()) | |
result = ownArgv.len-1 | |
proc paramStr*(i: int): TaintedString {.rtl, extern: "nos$1", | |
tags: [FReadIO].} = | |
- ## Returns the `i`-th `command line argument`:idx: given to the | |
- ## application. | |
- ## | |
- ## `i` should be in the range `1..paramCount()`, else | |
- ## the `EOutOfIndex` exception is raised. | |
+ # See docstring in nimdoc block. | |
if isNil(ownArgv): ownArgv = parseCmdLine($getCommandLine()) | |
return TaintedString(ownArgv[i]) | |
@@ -1513,10 +1520,13 @@ elif not defined(createNimRtl): | |
cmdLine {.importc: "cmdLine".}: cstringArray | |
proc paramStr*(i: int): TaintedString {.tags: [FReadIO].} = | |
+ # See docstring in nimdoc block. | |
if i < cmdCount and i >= 0: return TaintedString($cmdLine[i]) | |
raise newException(EInvalidIndex, "invalid index") | |
- proc paramCount*(): int {.tags: [FReadIO].} = return cmdCount-1 | |
+ proc paramCount*(): int {.tags: [FReadIO].} = | |
+ # See docstring in nimdoc block. | |
+ return cmdCount-1 | |
when defined(paramCount): | |
proc commandLineParams*(): seq[TaintedString] = |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment