aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2018-12-04 11:11:34 -0600
committerGanesh Viswanathan <dev@genotrance.com>2018-12-04 11:11:34 -0600
commitcb100ca5717ecc34112f1e5c5aac09439676c4ba (patch)
treee2183c39de0a333817ad7cbed83445e7b421a2d3
parent4fe3b0380ccf14ebb8a241c51d0e0355ff4bb2d6 (diff)
downloadnimterop-cb100ca5717ecc34112f1e5c5aac09439676c4ba.tar.gz
nimterop-cb100ca5717ecc34112f1e5c5aac09439676c4ba.zip
Add short CLI flags, --source= not required
-rw-r--r--nimterop/cimport.nim2
-rw-r--r--toast.nim13
2 files changed, 9 insertions, 6 deletions
diff --git a/nimterop/cimport.nim b/nimterop/cimport.nim
index 758237b..d671ee4 100644
--- a/nimterop/cimport.nim
+++ b/nimterop/cimport.nim
@@ -34,7 +34,7 @@ proc getToast(fullpath: string): string =
for i in gStateCT.includeDirs:
cmd.add &"--includeDirs+={i.quoteShell} "
- cmd.add &"--source:{fullpath.quoteShell}"
+ cmd.add &"{fullpath.quoteShell}"
echo cmd
var (output, exitCode) = gorgeEx(cmd)
doAssert exitCode == 0, $exitCode
diff --git a/toast.nim b/toast.nim
index f743264..948a517 100644
--- a/toast.nim
+++ b/toast.nim
@@ -109,10 +109,8 @@ proc main(
preprocess = false,
defines: seq[string] = @[],
includeDirs: seq[string] = @[],
- # defines.add(param[2..^1].strip(chars={'"'}))
- source: string,
+ source: seq[string],
) =
- # TODO: should we add back `-m` param? meaning was: print minimized AST output - non-pretty (implies -a)
gStateRT = State(
mode: mode,
@@ -120,11 +118,10 @@ proc main(
pnim: pnim,
pretty: pretty,
preprocess: preprocess,
- # Note: was: strip(chars={'"'} but that seemed buggy (the shell should remove these already)
defines: defines,
includeDirs: includeDirs,
)
- process(source)
+ process(source[0])
when isMainModule:
import cligen
@@ -136,4 +133,10 @@ when isMainModule:
"includeDirs": "include directory to pass to preprocessor",
"preprocess": "print Nim output",
"source" : "C/C++ source/header",
+ }, short = {
+ "past": 'a',
+ "pnim": 'n',
+ "defines": 'D',
+ "includeDirs": 'I',
+ "preprocess": 'p'
})