Skip to content

Commit 1ed2144

Browse files
committed
abstracted away the need to trim single or double quotes
1 parent 506685b commit 1ed2144

File tree

6 files changed

+1
-9
lines changed

6 files changed

+1
-9
lines changed

src/Commands/Base/Completers/ContentTypeCompleter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ public sealed class ContentTypeCompleter : PnPArgumentCompleter
1313
{
1414
public override IEnumerable<CompletionResult> GetArguments(string commandName, string parameterName, string wordToComplete, CommandAst commandAst, IDictionary fakeBoundParameters)
1515
{
16-
wordToComplete = wordToComplete.Trim('"');
17-
1816
IEnumerable<ContentType> result = PnPConnection.Current.Context.LoadQuery(PnPConnection.Current.Context.Web.AvailableContentTypes.Include(f => f.Name));
1917
PnPConnection.Current.Context.ExecuteQueryRetry();
2018
foreach (var ct in result.Where(l => l.Name.StartsWith(wordToComplete, StringComparison.InvariantCultureIgnoreCase)))

src/Commands/Base/Completers/FieldInternalNameCompleter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ public sealed class FieldInternalNameCompleter : PnPArgumentCompleter
1313
{
1414
public override IEnumerable<CompletionResult> GetArguments(string commandName, string parameterName, string wordToComplete, CommandAst commandAst, IDictionary fakeBoundParameters)
1515
{
16-
wordToComplete = wordToComplete.Trim('"');
17-
1816
IEnumerable<Field> result = PnPConnection.Current.Context.LoadQuery(PnPConnection.Current.Context.Web.AvailableFields.Include(f => f.InternalName));
1917
PnPConnection.Current.Context.ExecuteQueryRetry();
2018
foreach (var field in result.Where(l => l.InternalName.StartsWith(wordToComplete, StringComparison.InvariantCultureIgnoreCase)))

src/Commands/Base/Completers/ListNameCompleter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ public sealed class ListNameCompleter : PnPArgumentCompleter
1212
{
1313
public override IEnumerable<CompletionResult> GetArguments(string commandName, string parameterName, string wordToComplete, CommandAst commandAst, IDictionary fakeBoundParameters)
1414
{
15-
wordToComplete = wordToComplete.Trim('"');
16-
1715
IEnumerable<List> result = PnPConnection.Current.Context.LoadQuery(PnPConnection.Current.Context.Web.Lists.Include(list => list.Title));
1816
PnPConnection.Current.Context.ExecuteQueryRetry();
1917
foreach (var list in result.Where(l => l.Title.StartsWith(wordToComplete, StringComparison.InvariantCultureIgnoreCase)))

src/Commands/Base/Completers/PageCompleter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public sealed class PageCompleter : PnPArgumentCompleter
1919
public override IEnumerable<CompletionResult> GetArguments(string commandName, string parameterName, string wordToComplete, CommandAst commandAst, IDictionary fakeBoundParameters)
2020
{
2121
List<CompletionResult> results = new List<CompletionResult>();
22-
wordToComplete = wordToComplete.Trim('"');
2322
wordToComplete = wordToComplete.Replace('\\', '/');
2423
var pages = PnPConnection.Current.PnPContext.Web.GetPages(wordToComplete.TrimStart('/'));
2524
foreach (var page in pages.OrderBy(p => p.Name))

src/Commands/Base/Completers/PnPArgumentCompleter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public abstract class PnPArgumentCompleter : IArgumentCompleter
1212
private const int Timeout = 2000;
1313
public IEnumerable<CompletionResult> CompleteArgument(string commandName, string parameterName, string wordToComplete, CommandAst commandAst, IDictionary fakeBoundParameters)
1414
{
15+
wordToComplete = wordToComplete.Trim(['"', '\'']);
1516
var task = Task.Run(() => GetArguments(commandName, parameterName, wordToComplete, commandAst, fakeBoundParameters));
1617
return task.TimeoutAfter(TimeSpan.FromMilliseconds(GetTimeOut())).GetAwaiter().GetResult();
1718
}

src/Commands/Base/Completers/PropertyBagKeyCompleter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ public sealed class PropertyBagKeyCompleter : IArgumentCompleter
1414
{
1515
public IEnumerable<CompletionResult> CompleteArgument(string commandName, string parameterName, string wordToComplete, CommandAst commandAst, IDictionary fakeBoundParameters)
1616
{
17-
wordToComplete = wordToComplete.Trim('"');
18-
1917
IEnumerable<string> keys = null;
2018
if (fakeBoundParameters["Folder"] == null)
2119
{

0 commit comments

Comments
 (0)