Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
genotrance committed Apr 26, 2018
2 parents e9a8850 + c249f9b commit 2fc3106
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:

Expand Down
6 changes: 4 additions & 2 deletions src/nimble.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions src/nimblepkg/options.nim
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2fc3106

Please sign in to comment.