This commit is contained in:
Dominik Picheta 2018-02-27 18:18:42 +00:00
parent c1c03bbcf2
commit 47bdbc77f9
2 changed files with 10 additions and 2 deletions

View file

@ -114,7 +114,7 @@ proc updateSelf(params: CliParams) =
proc update(params: CliParams) =
if params.commands.len != 2:
raise newException(ChooseNimError,
"Expected 1 parameter to 'update' command")
"Expected 1 parameter to 'update' command")
let channel = params.commands[1]
if channel.toLowerAscii() == "self":
@ -130,6 +130,8 @@ proc update(params: CliParams) =
if not canUpdate(version, params):
display("Info:", "Already up to date at version " & $version,
Success, HighPriority)
if getSelectedVersion(params) != version:
switchTo(version, params)
return
# Make sure the archive is downloaded again if the version is special.
@ -155,7 +157,7 @@ proc show(params: CliParams) =
else:
display("Channel:", "No channel selected", priority = HighPriority)
let (name, version) = getNameVersion(path)
let (_, version) = getNameVersion(path)
if version != "":
display("Version:", version, priority = HighPriority)

View file

@ -1,6 +1,7 @@
import os, strutils, osproc, pegs
import nimblepkg/[cli, version, options]
from nimblepkg/packageinfo import getNameVersion
import cliparams, common
@ -185,3 +186,8 @@ proc switchTo*(filepath: string, params: CliParams) =
else:
display("Info:", "Path '$1' already selected" % filepath,
priority = HighPriority)
proc getSelectedVersion*(params: CliParams): Version =
let path = getSelectedPath(params)
let (_, version) = getNameVersion(path)
return version.newVersion