Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
Unless --details is specified, hide dependency sources
Browse files Browse the repository at this point in the history
  • Loading branch information
troydai committed Apr 10, 2015
1 parent a280589 commit 7739575
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/Microsoft.Framework.PackageManager/List/AssemblyWalker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class AssemblyWalker
private readonly FrameworkName _framework;
private readonly ApplicationHostContext _hostContext;
private readonly string _runtimeFolder;
private readonly bool _hideDependents;
private readonly bool _showDetails;
private readonly Reports _reports;

private HashSet<string> _assemblyFilePaths;
Expand All @@ -30,13 +30,13 @@ public AssemblyWalker(
FrameworkName framework,
ApplicationHostContext hostContext,
string runtimeFolder,
bool hideDependents,
bool showDetails,
Reports reports)
{
_framework = framework;
_hostContext = hostContext;
_runtimeFolder = runtimeFolder;
_hideDependents = hideDependents;
_showDetails = showDetails;
_reports = reports;
}

Expand All @@ -55,7 +55,7 @@ public void Walk(IGraphNode<LibraryDescription> root)
foreach (var assemblyFilePath in _assemblyFilePaths.OrderBy(assemblyName => assemblyName))
{
_reports.Information.WriteLine(assemblyFilePath);
if (!_hideDependents)
if (_showDetails)
{
var assemblyName = Path.GetFileNameWithoutExtension(assemblyFilePath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public bool Execute()
var assemblyWalker = new AssemblyWalker(_framework,
_hostContext,
_options.RuntimeFolder,
_options.HideDependents,
_options.Details,
_options.Reports);
assemblyWalker.Walk(root);

Expand All @@ -49,7 +49,7 @@ public bool Execute()

private void Render(IGraphNode<LibraryDescription> root)
{
var renderer = new LibraryDependencyFlatRenderer(_options.HideDependents,
var renderer = new LibraryDependencyFlatRenderer(_options.Details,
_options.ResultsFilter,
_options.Project.Dependencies.Select(dep => dep.LibraryRange.Name));
var content = renderer.GetRenderContent(root);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public DependencyListOptions(Reports reports, CommandArgument path)

public IEnumerable<string> TargetFrameworks { get; set; }

public bool HideDependents { get; set; }
public bool Details { get; set; }

public string ResultsFilter { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ namespace Microsoft.Framework.PackageManager.List
{
public class LibraryDependencyFlatRenderer
{
private readonly bool _hideDependent;
private readonly bool _showDetails;
private readonly string _filterPattern;
private readonly HashSet<string> _listedProjects;

public LibraryDependencyFlatRenderer(bool hideDependent, string filterPattern, IEnumerable<string> listedProjects)
public LibraryDependencyFlatRenderer(bool showDetails, string filterPattern, IEnumerable<string> listedProjects)
{
_hideDependent = hideDependent;
_showDetails = showDetails;
_filterPattern = filterPattern;
_listedProjects = new HashSet<string>(listedProjects);
}
Expand Down Expand Up @@ -87,7 +87,7 @@ private void RenderLibraries(IEnumerable<LibraryDescription> descriptions,
results.Add(string.Format("{0} - Unresolved", libDisplay).Red().Bold());
}

if (!_hideDependent)
if (_showDetails)
{
var dependents = string.Join(", ", dependenciesMap[description].Select(dep => dep.ToString()).OrderBy(name => name));
results.Add(string.Format(" from: {0}", dependents));
Expand Down
10 changes: 4 additions & 6 deletions src/Microsoft.Framework.PackageManager/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
using System.Net;
using System.Reflection;
using System.Threading;
using Microsoft.Framework.PackageManager.Packages;
using Microsoft.Framework.PackageManager.List;
using Microsoft.Framework.PackageManager.Packages;
using Microsoft.Framework.PackageManager.Publish;
using Microsoft.Framework.Runtime;
using Microsoft.Framework.Runtime.Common.CommandLine;
using System.Linq;
using System.Diagnostics;

namespace Microsoft.Framework.PackageManager
{
Expand Down Expand Up @@ -370,8 +368,8 @@ public int Main(string[] args)
var runtimeFolder = c.Option("--runtime <PATH>",
"The folder containing all available framework assemblies",
CommandOptionType.SingleValue);
var hideDependents = c.Option("--hide-dependents",
"Hide the immediate dependents of libraries referenced in the project",
var details = c.Option("--details",
"Show the details of how each dependency is introduced",
CommandOptionType.NoValue);
var resultsFilter = c.Option("--filter <PATTERN>",
"Filter the libraries referenced by the project base on their names. The matching pattern supports * and ?",
Expand All @@ -386,7 +384,7 @@ public int Main(string[] args)
TargetFrameworks = frameworks.Values,
ShowAssemblies = showAssemblies.HasValue(),
RuntimeFolder = runtimeFolder.Value(),
HideDependents = hideDependents.HasValue(),
Details = details.HasValue(),
ResultsFilter = resultsFilter.Value()
};
Expand Down

0 comments on commit 7739575

Please sign in to comment.