mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
31 lines
1001 B
C#
31 lines
1001 B
C#
using Remotely.Shared.Models;
|
|
using Remotely.Shared.Utilities;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Management.Automation;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Remotely.Agent.Extensions;
|
|
|
|
public static class PowerShellCompletionExtensions
|
|
{
|
|
public static PwshCommandCompletion ToPwshCompletion(this CommandCompletion completion)
|
|
{
|
|
return new PwshCommandCompletion()
|
|
{
|
|
CurrentMatchIndex = completion.CurrentMatchIndex,
|
|
ReplacementIndex = completion.ReplacementIndex,
|
|
ReplacementLength = completion.ReplacementLength,
|
|
CompletionMatches = completion.CompletionMatches
|
|
.Select(x => new PwshCompletionResult(x.CompletionText,
|
|
x.ListItemText,
|
|
EnumMapper.ToEnum<PwshCompletionResultType, CompletionResultType>(x.ResultType),
|
|
x.ToolTip))
|
|
.ToList()
|
|
};
|
|
|
|
}
|
|
}
|