nim-lang / nimble

Package manager for the Nim programming language.
Other
1.24k stars 174 forks source link

`nimble setup` adds empty lines to `config.nims` #1181

Closed narimiran closed 3 months ago

narimiran commented 4 months ago

Running nimble setup (multiple times), every time there is some change in config.nims, it also adds a new empty line at the top of it.

--- a/config.nims
+++ b/config.nims
@@ -1,6 +1,8 @@

+
 # begin Nimble config (version 2)
+--noNimblePath
 when withDir(thisDir(), system.fileExists("nimble.paths")):
   include "nimble.paths"
 # end Nimble config

Notice that two empty lines already exist (from previous buggy runs of that command), and now it adds a third empty line.

Removing nimble.lock and nimble.paths and running nimble setup again, produces:

--- a/config.nims
+++ b/config.nims
@@ -1,5 +1,7 @@

+
+
 # begin Nimble config (version 2)
 when withDir(thisDir(), system.fileExists("nimble.paths")):
   include "nimble.paths"

Now, running nimble lock and then nimble setup produces:

--- a/config.nims
+++ b/config.nims
@@ -1,6 +1,10 @@

+
+
+
 # begin Nimble config (version 2)
+--noNimblePath
 when withDir(thisDir(), system.fileExists("nimble.paths")):
   include "nimble.paths"
 # end Nimble config