diff --git a/readme.markdown b/readme.markdown index be1ea69a..a3fabfd5 100644 --- a/readme.markdown +++ b/readme.markdown @@ -303,7 +303,7 @@ which can be useful to read the bundled documentation. Example: ### nimble init The nimble ``init`` command will start a simple wizard which will create -a quick ``.nimble`` file for your project. +a quick ``.nimble`` file for your project in the current directory. As of version 0.7.0, the ``.nimble`` file that this command creates will use the new NimScript format. @@ -391,7 +391,7 @@ a package. A .nimble file can be created easily using Nimble's ``init`` command. This command will ask you a bunch of questions about your package, then generate a -.nimble file for you. +.nimble file for you in the current directory. A bare minimum .nimble file follows: diff --git a/src/nimble.nim b/src/nimble.nim index f51f7fdc..b936ad9e 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -723,8 +723,10 @@ proc init(options: Options) = nimbleFile = pkgName.changeFileExt("nimble") validatePackageName(nimbleFile.changeFileExt("")) - if existsFile(os.getCurrentDir() / nimbleFile): - raise newException(NimbleError, "Nimble file already exists.") + let nimbleFilePath = os.getCurrentDir() / nimbleFile + if existsFile(nimbleFilePath): + let errMsg = "Nimble file already exists: $#" % nimbleFilePath + raise newException(NimbleError, errMsg) display("Using", "$# for new package name" % [pkgName.escape()], priority = HighPriority) diff --git a/src/nimblepkg/options.nim b/src/nimblepkg/options.nim index 725b5ba0..63fe5a0f 100644 --- a/src/nimblepkg/options.nim +++ b/src/nimblepkg/options.nim @@ -1,7 +1,7 @@ # Copyright (C) Dominik Picheta. All rights reserved. # BSD License. Look at license.txt for more info. -import json, strutils, os, parseopt, strtabs, uri, tables +import json, strutils, os, parseopt, strtabs, uri, tables, terminal from httpclient import Proxy, newProxy import config, version, tools, common, cli @@ -62,7 +62,8 @@ Commands: in the current working directory. check Verifies the validity of a package in the current working directory. - init [pkgname] Initializes a new Nimble project. + init [pkgname] Initializes a new Nimble project in the + current directory. publish Publishes a package on nim-lang/packages. The current working directory needs to be the toplevel directory of the Nimble package. @@ -328,6 +329,7 @@ proc initOptions*(): Options = result.pkgInfoCache = newTable[string, PackageInfo]() result.nimbleDir = "" result.verbosity = HighPriority + result.noColor = not isatty(stdout) proc parseMisc(options: var Options) = # Load nimbledata.json