summary refs log tree commit diff stats
path: root/nimsuggest/nimsuggest.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-10-11 12:11:47 +0200
committerAndreas Rumpf <rumpf_a@web.de>2020-10-11 20:44:04 +0200
commit3492178494484e0c0c1d8eec83aadc5b2ad06ede (patch)
tree7db5bb72a42269b8d15473320dcef3531a564c88 /nimsuggest/nimsuggest.nim
parentc2c7f6025922034073418e608a62f8f4d5a5b381 (diff)
downloadNim-3492178494484e0c0c1d8eec83aadc5b2ad06ede.tar.gz
refactoring: removed cmdlinehelper.mainCommand callback
Diffstat (limited to 'nimsuggest/nimsuggest.nim')
-rw-r--r--nimsuggest/nimsuggest.nim14
1 files changed, 8 insertions, 6 deletions
diff --git a/nimsuggest/nimsuggest.nim b/nimsuggest/nimsuggest.nim
index 9a0962df3..afc692241 100644
--- a/nimsuggest/nimsuggest.nim
+++ b/nimsuggest/nimsuggest.nim
@@ -619,8 +619,7 @@ proc processCmdLine*(pass: TCmdLinePass, cmd: string; conf: ConfigRef) =
 proc handleCmdLine(cache: IdentCache; conf: ConfigRef) =
   let self = NimProg(
     suggestMode: true,
-    processCmdLine: processCmdLine,
-    mainCommand: mainCommand
+    processCmdLine: processCmdLine
   )
   self.initDefinesProg(conf, "nimsuggest")
 
@@ -644,7 +643,9 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) =
   #msgs.writelnHook = proc (line: string) = log(line)
   myLog("START " & conf.projectFull.string)
 
-  discard self.loadConfigsAndRunMainCommand(cache, conf)
+  var graph = newModuleGraph(cache, conf)
+  if self.loadConfigsAndRunMainCommand(cache, conf, graph):
+    mainCommand(graph)
 
 when isMainModule:
   handleCmdLine(newIdentCache(), newConfigRef())
@@ -698,8 +699,7 @@ else:
       conf = newConfigRef()
       self = NimProg(
         suggestMode: true,
-        processCmdLine: mockCmdLine,
-        mainCommand: mockCommand
+        processCmdLine: mockCmdLine
       )
     self.initDefinesProg(conf, "nimsuggest")
 
@@ -722,7 +722,9 @@ else:
     #msgs.writelnHook = proc (line: string) = log(line)
     myLog("START " & conf.projectFull.string)
 
-    discard self.loadConfigsAndRunMainCommand(cache, conf)
+    var graph = newModuleGraph(cache, conf)
+    if self.loadConfigsAndRunMainCommand(cache, conf, graph):
+      mockCommand(graph)
     if gLogging:
       for it in conf.searchPaths:
         log(it.string)