diff --git a/src/Paket.Core/FindOutdated.fs b/src/Paket.Core/FindOutdated.fs index 46d20e6252..8ad14091ce 100644 --- a/src/Paket.Core/FindOutdated.fs +++ b/src/Paket.Core/FindOutdated.fs @@ -25,7 +25,7 @@ let private adjustVersionRequirements strict includingPrereleases (dependenciesF DependenciesFile(dependenciesFile.FileName, groups, dependenciesFile.Lines) /// Finds all outdated packages. -let FindOutdated strict includingPrereleases environment = trial { +let FindOutdated strict includingPrereleases groupNameFilter environment = trial { let! lockFile = environment |> PaketEnv.ensureLockFileExists let force = true @@ -45,11 +45,20 @@ let FindOutdated strict includingPrereleases environment = trial { |> List.toSeq let dependenciesFile = UpdateProcess.detectProjectFrameworksForDependenciesFile dependenciesFile + let checkedDepsGroups = + match groupNameFilter with + | None -> dependenciesFile.Groups + | Some gname -> dependenciesFile.Groups |> Map.filter(fun k g -> k.ToString() = gname) - let newResolution = dependenciesFile.Resolve(force, getSha1, getVersionsF, NuGetV2.GetPackageDetails root true, dependenciesFile.Groups, PackageResolver.UpdateMode.UpdateAll) + let newResolution = dependenciesFile.Resolve(force, getSha1, getVersionsF, NuGetV2.GetPackageDetails root true, checkedDepsGroups, PackageResolver.UpdateMode.UpdateAll) + + let checkedLockGroups = + match groupNameFilter with + | None -> lockFile.Groups + | Some gname -> lockFile.Groups |> Map.filter(fun k g -> k.ToString() = gname) let changed = - [for kv in lockFile.Groups do + [for kv in checkedLockGroups do match newResolution |> Map.tryFind kv.Key with | Some group -> let newPackages = group.ResolvedPackages.GetModelOrFail() @@ -77,7 +86,7 @@ let private printOutdated changed = tracefn " * %O %O -> %O" packageName oldVersion newVersion /// Prints all outdated packages. -let ShowOutdated strict includingPrereleases environment = trial { - let! allOutdated = FindOutdated strict includingPrereleases environment +let ShowOutdated strict includingPrereleases groupName environment = trial { + let! allOutdated = FindOutdated strict includingPrereleases groupName environment printOutdated allOutdated } \ No newline at end of file diff --git a/src/Paket.Core/PublicAPI.fs b/src/Paket.Core/PublicAPI.fs index c1b4f68f4f..22c326184a 100644 --- a/src/Paket.Core/PublicAPI.fs +++ b/src/Paket.Core/PublicAPI.fs @@ -284,12 +284,12 @@ type Dependencies(dependenciesFileName: string) = this.Restore(force, group, Array.toList referencesFiles, touchAffectedRefs, ignoreChecks) /// Lists outdated packages. - member this.ShowOutdated(strict: bool,includePrereleases: bool): unit = - FindOutdated.ShowOutdated strict includePrereleases |> this.Process + member this.ShowOutdated(strict: bool,includePrereleases: bool, groupName: string Option): unit = + FindOutdated.ShowOutdated strict includePrereleases groupName |> this.Process /// Finds all outdated packages. - member this.FindOutdated(strict: bool,includePrereleases: bool): (string * string * SemVerInfo) list = - FindOutdated.FindOutdated strict includePrereleases + member this.FindOutdated(strict: bool,includePrereleases: bool, groupName: string Option): (string * string * SemVerInfo) list = + FindOutdated.FindOutdated strict includePrereleases groupName |> this.Process |> List.map (fun (g, p,_,newVersion) -> g.ToString(),p.ToString(),newVersion) diff --git a/src/Paket/Commands.fs b/src/Paket/Commands.fs index e2632ec21a..0c327f39ad 100644 --- a/src/Paket/Commands.fs +++ b/src/Paket/Commands.fs @@ -118,12 +118,14 @@ with type OutdatedArgs = | Ignore_Constraints + | [] Group of name:string | [] Include_Prereleases with interface IArgParserTemplate with member this.Usage = match this with | Ignore_Constraints -> "Ignores the version requirement as in the paket.dependencies file." + | Group(_) -> "Just check for one group." | Include_Prereleases -> "Includes prereleases." type RemoveArgs = diff --git a/src/Paket/Program.fs b/src/Paket/Program.fs index d6f8dca277..a177a74fe8 100644 --- a/src/Paket/Program.fs +++ b/src/Paket/Program.fs @@ -136,7 +136,8 @@ let install (results : ParseResults<_>) = let outdated (results : ParseResults<_>) = let strict = results.Contains <@ OutdatedArgs.Ignore_Constraints @> |> not let includePrereleases = results.Contains <@ OutdatedArgs.Include_Prereleases @> - Dependencies.Locate().ShowOutdated(strict, includePrereleases) + let group = results.TryGetResult <@ OutdatedArgs.Group @> + Dependencies.Locate().ShowOutdated(strict, includePrereleases, group) let remove (results : ParseResults<_>) = let packageName = results.GetResult <@ RemoveArgs.Nuget @>