@@ 0,0 1,8 @@
+import ../lib/[common, repository, stash, types, utils]
+
+proc outdated*() =
+ for pkg in getInstalledPackages():
+ let (url, pkgDef) = downloadPackageDefinition(pkg, true)
+ let lastVersion = getLastVersion(pkgDef.get_tags)
+ if semverCmp(pkg.ver, lastVersion) == -1:
+ log($pkg.name & " is outdated (" & pkg.ver & " => " & lastVersion & ")")
@@ 4,9 4,10 @@ import ./common, ./types, ./utils
const baseUrl = "https://nyrst.github.io/freezer/{brrr_package_name}.yaml"
-proc downloadPackageDefinition*(pkg: PkgTuple): (string, BrrrFile) =
+proc downloadPackageDefinition*(pkg: PkgTuple, quiet = false): (string, BrrrFile) =
let url = baseUrl.replace("{brrr_package_name}", pkg.name)
- log("Fetching package definition: " & url)
+ if quiet == false:
+ log("Fetching package definition: " & url)
var client = newHttpClient()
var s = newStringStream(client.getContent(url))
var brrrFile: BrrrFile
@@ 1,14 1,14 @@
import std/[parseopt, strutils]
-import commands/[freezer, help, install, uninstall, upgrade, version], lib/types
+import commands/[freezer, help, install, outdated, uninstall, upgrade, version], lib/types
# Many lines come from nimble.
type
ActionType* = enum
- actionNil, actionFreezer, actionHelp, actionInstall, actionUninstall, actionUpgrade, actionVersion
+ actionNil, actionFreezer, actionHelp, actionInstall, actionOutdated, actionUninstall, actionUpgrade, actionVersion
Action* = object
case typ*: ActionType
- of actionNil, actionHelp, actionVersion: nil
+ of actionNil, actionHelp, actionOutdated, actionVersion: nil
of actionFreezer:
sub*: string
of actionInstall, actionUninstall, actionUpgrade:
@@ 24,6 24,8 @@ proc parseActionType*(action: string): ActionType =
result = actionHelp
of "install":
result = actionInstall
+ of "outdated":
+ result = actionOutdated
of "uninstall":
result = actionUninstall
of "upgrade":
@@ 40,7 42,7 @@ proc parseArgument*(key: string, result: var Options) =
case result.action.typ
of actionNil:
assert false
- of actionHelp, actionVersion:
+ of actionHelp, actionOutdated, actionVersion:
discard
of actionFreezer:
result.action.sub = key
@@ 60,6 62,8 @@ proc doAction*(options: var Options) =
freezer(options.action.sub)
of actionInstall:
install(options.action.packages)
+ of actionOutdated:
+ outdated()
of actionUninstall:
uninstall(options.action.packages)
of actionUpgrade: