From cb100ca5717ecc34112f1e5c5aac09439676c4ba Mon Sep 17 00:00:00 2001 From: Ganesh Viswanathan Date: Tue, 4 Dec 2018 11:11:34 -0600 Subject: Add short CLI flags, --source= not required --- nimterop/cimport.nim | 2 +- toast.nim | 13 ++++++++----- 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' }) -- cgit v1.2.3