aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2018-07-13 20:06:09 -0500
committerGanesh Viswanathan <dev@genotrance.com>2018-07-13 20:06:09 -0500
commit29d694d630090e410a65f396adf5e91ced619d29 (patch)
treebd6b7400fcaf46d188d170b22e45e01246ae6c32
parent28a803e2cbed82be136dad9670a5bbbb1983e929 (diff)
downloadnimgen-29d694d630090e410a65f396adf5e91ced619d29.tar.gz
nimgen-29d694d630090e410a65f396adf5e91ced619d29.zip
Implement #11 - comma separated for OS specific tasks
-rw-r--r--README.md2
-rw-r--r--src/nimgen/runcfg.nim11
2 files changed, 8 insertions, 5 deletions
diff --git a/README.md b/README.md
index df949b8..5a1945d 100644
--- a/README.md
+++ b/README.md
@@ -106,7 +106,7 @@ List of all directories or files to exclude from all parsing. If an entry here m
_[n.prepare]_
-The following keys can be used to prepare dependencies such as downloading ZIP files, cloning Git repositories, etc. Multiple entries are possible by appending any .string to the key. E.g. download.file1. -win, -lin and -osx can be used for OS specific tasks. E.g. download-win
+The following keys can be used to prepare dependencies such as downloading ZIP files, cloning Git repositories, etc. Multiple entries are possible by appending any .string to the key. E.g. download.file1. -win, -lin and -mac/osx can be used for OS specific tasks. E.g. download-win, execute-lin,mac.unique1
```download``` = url to download to the output directory. ZIP files are automatically extracted. Files are not redownloaded if already present but re-extracted
diff --git a/src/nimgen/runcfg.nim b/src/nimgen/runcfg.nim
index 32146b8..105cede 100644
--- a/src/nimgen/runcfg.nim
+++ b/src/nimgen/runcfg.nim
@@ -11,12 +11,15 @@ proc getKey(ukey: string): tuple[key: string, val: bool] =
if kv.len() == 1:
kv.add("")
- if (kv[1] == "") or
- (kv[1] == "win" and defined(Windows)) or
- (kv[1] == "lin" and defined(Linux)) or
- (kv[1] == "osx" and defined(MacOSX)):
+ if kv[1] == "":
return (kv[0], true)
+ for ostyp in kv[1].split(","):
+ if (ostyp == "win" and defined(Windows)) or
+ (ostyp == "lin" and defined(Linux)) or
+ ((ostyp == "osx" or ostyp == "mac") and defined(MacOSX)):
+ return (kv[0], true)
+
return (kv[0], false)
proc runFile*(file: string, cfgin: OrderedTableRef = newOrderedTable[string, string]()) =