-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
0b4a51a
commit 3f31b04
Showing
4 changed files
with
123 additions
and
0 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,48 @@ | ||
// Copyright (c) Thomas Nieto - All Rights Reserved | ||
// You may use, distribute and modify this code under the | ||
// terms of the MIT license. | ||
|
||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
using System.Management.Automation.Language; | ||
|
||
namespace AnyPackage.Provider.DotNet | ||
{ | ||
public sealed class ArchitectureCompleter : IArgumentCompleter | ||
{ | ||
private static string[] architectures = new string[] | ||
{ | ||
"android-arm64", | ||
"ios-arm64", | ||
"linux-arm", | ||
"linux-arm64", | ||
"linux-bionic-arm64", | ||
"linux-musl-arm64", | ||
"linux-musl-x64", | ||
"linux-x64", | ||
"osx-arm64", | ||
"osx-x64", | ||
"win-arm64", | ||
"win-x64", | ||
"win-x86" | ||
}; | ||
|
||
public IEnumerable<CompletionResult> CompleteArgument(string commandName, | ||
string parameterName, | ||
string wordToComplete, | ||
CommandAst commandAst, | ||
IDictionary fakeBoundParameters) | ||
{ | ||
var wildcard = new WildcardPattern(wordToComplete + "*", WildcardOptions.IgnoreCase); | ||
|
||
foreach (var arch in architectures) | ||
{ | ||
if (wildcard.IsMatch(arch)) | ||
{ | ||
yield return new CompletionResult(arch, arch, CompletionResultType.ParameterValue, arch); | ||
} | ||
} | ||
} | ||
} | ||
} |
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,20 @@ | ||
// Copyright (c) Thomas Nieto - All Rights Reserved | ||
// You may use, distribute and modify this code under the | ||
// terms of the MIT license. | ||
|
||
using System.Management.Automation; | ||
|
||
namespace AnyPackage.Provider.DotNet | ||
{ | ||
public sealed class InstallPackageDynamicParameters | ||
{ | ||
[Parameter] | ||
[ArgumentCompleter(typeof(ArchitectureCompleter))] | ||
[ValidateNotNullOrEmpty] | ||
public string Architecture { get; set; } = string.Empty; | ||
|
||
[Parameter] | ||
[ValidateNotNullOrEmpty] | ||
public string Framework { get; set; } = string.Empty; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (c) Thomas Nieto - All Rights Reserved | ||
// You may use, distribute and modify this code under the | ||
// terms of the MIT license. | ||
|
||
using System.Management.Automation; | ||
|
||
namespace AnyPackage.Provider.DotNet | ||
{ | ||
public sealed class UpdatePackageDynamicParameters | ||
{ | ||
[Parameter] | ||
[ValidateNotNullOrEmpty] | ||
public string Framework { get; set; } = string.Empty; | ||
} | ||
} |