This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
William Li
committed
Dec 4, 2018
1 parent
9ed8cf2
commit 2f260f7
Showing
23 changed files
with
306 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.Extensions.EnvironmentAbstractions; | ||
|
||
namespace Microsoft.DotNet.ToolManifest | ||
{ | ||
internal interface IToolManifestInspector | ||
{ | ||
IReadOnlyCollection<(ToolManifestPackage toolManifestPackage, FilePath SourceManifest)> Inspect( | ||
FilePath? filePath = null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 0 additions & 115 deletions
115
src/dotnet/commands/dotnet-tool/list/LocalizableStrings.Designer.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/dotnet/commands/dotnet-tool/list/ToolListLocalCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using Microsoft.DotNet.Cli; | ||
using Microsoft.DotNet.Cli.CommandLine; | ||
using Microsoft.DotNet.Cli.Utils; | ||
using Microsoft.DotNet.ToolManifest; | ||
using Microsoft.Extensions.EnvironmentAbstractions; | ||
|
||
namespace Microsoft.DotNet.Tools.Tool.List | ||
{ | ||
internal class ToolListLocalCommand : CommandBase | ||
{ | ||
private readonly IToolManifestInspector _toolManifestInspector; | ||
private readonly IReporter _reporter; | ||
private const string CommandDelimiter = ", "; | ||
|
||
public ToolListLocalCommand( | ||
AppliedOption appliedCommand, | ||
ParseResult parseResult, | ||
IToolManifestInspector toolManifestInspector = null, | ||
IReporter reporter = null) | ||
: base(parseResult) | ||
{ | ||
if (appliedCommand == null) | ||
{ | ||
throw new ArgumentNullException(nameof(appliedCommand)); | ||
} | ||
|
||
_reporter = (reporter ?? Reporter.Output); | ||
|
||
_toolManifestInspector = toolManifestInspector ?? | ||
new ToolManifestFinder(new DirectoryPath(Directory.GetCurrentDirectory())); | ||
} | ||
|
||
public override int Execute() | ||
{ | ||
var table = new PrintableTable<(ToolManifestPackage toolManifestPackage, FilePath SourceManifest)>(); | ||
|
||
table.AddColumn( | ||
LocalizableStrings.PackageIdColumn, | ||
p => p.toolManifestPackage.PackageId.ToString()); | ||
table.AddColumn( | ||
LocalizableStrings.VersionColumn, | ||
p => p.toolManifestPackage.Version.ToNormalizedString()); | ||
table.AddColumn( | ||
LocalizableStrings.CommandsColumn, | ||
p => string.Join(CommandDelimiter, p.toolManifestPackage.CommandNames.Select(c => c.Value))); | ||
table.AddColumn( | ||
LocalizableStrings.ManifestFileColumn, | ||
p => p.SourceManifest.Value); | ||
|
||
table.PrintRows(_toolManifestInspector.Inspect(), l => _reporter.WriteLine(l)); | ||
return 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.