Skip to content

Commit 6dfd5b8

Browse files
committed
Disable tarballs downloads by default
Downloading of Nimble packages as tarballs when working with GitHub is now disabled by default. The option `--no-tarballs` for disabling it is removed and a new option `--tarballs` for explicitly enabling the feature is added instead. Related to #127
1 parent ad17ab1 commit 6dfd5b8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/nimblepkg/download.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ proc isGitHubRepo(url: string): bool =
180180

181181
proc downloadTarball(url: string, options: Options): bool =
182182
## Determines whether to download the repository as a tarball.
183-
hasTar() and
183+
options.enableTarballs and
184184
not options.forceFullClone and
185-
not options.noTarballs and
186-
url.isGitHubRepo
185+
url.isGitHubRepo and
186+
hasTar()
187187

188188
proc removeTrailingGitString*(url: string): string =
189189
## Removes ".git" from an URL.

src/nimblepkg/options.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type
4141
localdeps*: bool # True if project local deps mode
4242
developLocaldeps*: bool # True if local deps + nimble develop pkg1 ...
4343
disableSslCertCheck*: bool
44-
noTarballs*: bool # Disable downloading of packages as tarballs from GitHub.
44+
enableTarballs*: bool # Enable downloading of packages as tarballs from GitHub.
4545

4646
ActionType* = enum
4747
actionNil, actionRefresh, actionInit, actionDump, actionPublish,
@@ -185,7 +185,7 @@ Nimble Options:
185185
-y, --accept Accept all interactive prompts.
186186
-n, --reject Reject all interactive prompts.
187187
-l, --localdeps Run in project local dependency mode
188-
-t, --no-tarballs Disable downloading of packages as tarballs
188+
-t, --tarballs Enable downloading of packages as tarballs
189189
when working with GitHub repositories.
190190
--ver Query remote server for package version
191191
information when searching or listing packages.
@@ -475,7 +475,7 @@ proc parseFlag*(flag, val: string, result: var Options, kind = cmdLongOption) =
475475
of "nim": result.nim = val
476476
of "localdeps", "l": result.localdeps = true
477477
of "nosslcheck": result.disableSslCertCheck = true
478-
of "no-tarballs", "t": result.noTarballs = true
478+
of "tarballs", "t": result.enableTarballs = true
479479
else: isGlobalFlag = false
480480

481481
var wasFlagHandled = true

0 commit comments

Comments
 (0)