-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Microsoft.WinGet.Client PowerShell Module files (#2314)
- Loading branch information
Showing
32 changed files
with
3,214 additions
and
10 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
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
33 changes: 33 additions & 0 deletions
33
src/PowerShell/Microsoft.WinGet.Client/Commands/FindPackageCommand.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,33 @@ | ||
// ----------------------------------------------------------------------------- | ||
// <copyright file="FindPackageCommand.cs" company="Microsoft Corporation"> | ||
// Copyright (c) Microsoft Corporation. Licensed under the MIT License. | ||
// </copyright> | ||
// ----------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.WinGet.Client.Commands | ||
{ | ||
using System.Management.Automation; | ||
using Microsoft.Management.Deployment; | ||
using Microsoft.WinGet.Client.Common; | ||
|
||
/// <summary> | ||
/// Searches configured sources for packages. | ||
/// </summary> | ||
[Cmdlet(VerbsCommon.Find, Constants.PackageNoun)] | ||
[OutputType(typeof(MatchResult))] | ||
public sealed class FindPackageCommand : BaseFinderExtendedCommand | ||
{ | ||
/// <summary> | ||
/// Searches for configured sources for packages. | ||
/// </summary> | ||
protected override void ProcessRecord() | ||
{ | ||
base.ProcessRecord(); | ||
var results = this.FindPackages(CompositeSearchBehavior.RemotePackagesFromRemoteCatalogs); | ||
for (var i = 0; i < results.Count; i++) | ||
{ | ||
this.WriteObject(results[i]); | ||
} | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/PowerShell/Microsoft.WinGet.Client/Commands/GetPackageCommand.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,33 @@ | ||
// ----------------------------------------------------------------------------- | ||
// <copyright file="GetPackageCommand.cs" company="Microsoft Corporation"> | ||
// Copyright (c) Microsoft Corporation. Licensed under the MIT License. | ||
// </copyright> | ||
// ----------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.WinGet.Client.Commands | ||
{ | ||
using System.Management.Automation; | ||
using Microsoft.Management.Deployment; | ||
using Microsoft.WinGet.Client.Common; | ||
|
||
/// <summary> | ||
/// Searches configured sources for packages. | ||
/// </summary> | ||
[Cmdlet(VerbsCommon.Get, Constants.PackageNoun)] | ||
[OutputType(typeof(CatalogPackage))] | ||
public sealed class GetPackageCommand : BaseFinderExtendedCommand | ||
{ | ||
/// <summary> | ||
/// Searches for configured sources for packages. | ||
/// </summary> | ||
protected override void ProcessRecord() | ||
{ | ||
base.ProcessRecord(); | ||
var results = this.FindPackages(CompositeSearchBehavior.LocalCatalogs); | ||
for (var i = 0; i < results.Count; i++) | ||
{ | ||
this.WriteObject(results[i].CatalogPackage); | ||
} | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/PowerShell/Microsoft.WinGet.Client/Commands/GetSourceCommand.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,43 @@ | ||
// ----------------------------------------------------------------------------- | ||
// <copyright file="GetSourceCommand.cs" company="Microsoft Corporation"> | ||
// Copyright (c) Microsoft Corporation. Licensed under the MIT License. | ||
// </copyright> | ||
// ----------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.WinGet.Client.Commands | ||
{ | ||
using System; | ||
using System.Management.Automation; | ||
using Microsoft.Management.Deployment; | ||
using Microsoft.WinGet.Client.Common; | ||
|
||
/// <summary> | ||
/// Retrieves the list of configured sources. | ||
/// </summary> | ||
[Cmdlet(VerbsCommon.Get, Constants.SourceNoun)] | ||
[OutputType(typeof(PackageCatalogReference))] | ||
public sealed class GetSourceCommand : BaseClientCommand | ||
{ | ||
/// <summary> | ||
/// Gets or sets the name of the source to retrieve. | ||
/// </summary> | ||
[Parameter( | ||
Position = 0, | ||
ValueFromPipeline = true, | ||
ValueFromPipelineByPropertyName = true)] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Returns the list of configured sources. | ||
/// </summary> | ||
protected override void ProcessRecord() | ||
{ | ||
base.ProcessRecord(); | ||
var results = GetPackageCatalogReferences(this.Name); | ||
for (var i = 0; i < results.Count; i++) | ||
{ | ||
this.WriteObject(results[i]); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.