Quick command implementation (#472)

* Separating "SSH Info" and "Quick Launch", and updating translations.

* Adding "Quick Launch" to menu.

* Auto-complete, initial version.

* Builds, but not finished.

* Improved, but there are still some bugs...

* Minor changes.

* Refactroing request/response identifiers.

* Improving command history.

* Minor refactoring.

* Deleting history by using "Del" key.

* Handling mosh special case in quick commands.

* SSH command handled as any other command in the path.

* New resource strings.

* Fixing quick command links.

* Fixing after-merging bugs.

* Improving filtering.

* Finishing filtering.

* Changing placeholder text.

* Minor refactoring.

* Updating resources.

* Renaming NewRemoteTab back to NewSshTab.
This commit is contained in:
Aleksandar Pesic authored and Felix committed 2019-08-08 08:02:09 +02:00
1 parent 93e52f3209
commit e88fb78e9d
61 files changed
+2100 -706

No files matched your search

+26 -3
View File
@@ -1,12 +1,35 @@
namespace FluentTerminal.Models
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace FluentTerminal.Models
{
public static class StringExtensions
{
private static readonly Regex RxNonWhiteSpace = new Regex(@"\S+", RegexOptions.Compiled);
/// <summary>
/// Compares two strings for equality, but assumes that null string is equal to an empty string.
/// </summary>
public static bool NullableEqualTo(this string original, string other) => string.IsNullOrEmpty(original)
public static bool NullableEqualTo(this string original, string other,
StringComparison stringComparison = StringComparison.Ordinal) => string.IsNullOrEmpty(original)
? string.IsNullOrEmpty(other)
: original.Equals(other);
: original.Equals(other, stringComparison);
/// <summary>
/// Splits input text into words, by splitting at white-space characters. It doesn't take care about quotes.
/// </summary>
public static IEnumerable<string> SplitWords(this string text)
{
if (string.IsNullOrWhiteSpace(text))
{
yield break;
}
foreach (Match match in RxNonWhiteSpace.Matches(text.Trim()))
{
yield return match.Value;
}
}
}
}